-
only-child和only-of-type的区别:
only-child 只能在父元素里只有一个子元素的时候生效
only-of-child 可以在父元素有很多子元素的时候选择里面唯一的子元素
查看全部 -
bgd-size:auto|<length>|<percent>|cover|
contain
auto:不改变图片原始值
legth:设置图片宽高,等比缩放
percent:百分比缩放
cover:等比缩放填满整个 容器
contain:等比缩放至某一边紧贴边缘为止
查看全部 -
bgd-clip: border-box(默认值) | padding-box | content-box | no-clip
查看全部 -
使用服务器上的字体,需要在css中添加
@font-face{
font-family:字体名称;
src:字体在服务器上的相对或者绝对路径;
}
查看全部 -
text-overflow:clip | ellipsis;
overflow:hidden;
white-space:nowrap;
查看全部 -
当div的宽度为200PX,span标签宽度为20px,时
transform: translateY(90px);处于中间位置, transform: translateY(90px);
查看全部 -
标题:css选择器 样式:a[class^=icon]{ background: green; color:#fff; } a[href$=pdf]{ background: orange; color: #fff; } a[title*=more]{ background: blue; color: #fff; } html部分: <a href="xxx.pdf">我链接的是PDF文件</a> <a href="#" class="icon">我类名是icon</a> <a href="#" title="我的title是more">我的title是more</a>
查看全部 -
投影: box-shadow:0 5px 0 #B64B41;
导航分割线伪装元素:
.nav li::after{
content: '';
position: absolute; width: 1px; height: 13px; top: 18px; right: 0;
background-image: linear-gradient(to right, rgba(255,255,255,.5), grey);
}
.nav li:last-child::after{
background: none;
}
查看全部 -
odd奇数,even偶数。
“
:nth-of-type(n)
”选择器和“:nth-child(n)
”选择器非常类似,不同的是它只计算父元素中指定的某种类型的子元素。当某个元素中的子元素不单单是同一种类型的子元素时,使用“:nth-of-type(n)”选择器来定位于父元素中某种类型的子元素是非常方便和有用的。在“:nth-of-type(n)”选择器中的“n”和“:nth-child(n)”选择器中的“n”参数也一样,可以是具体的整数,也可以是表达式,还可以是关键词。查看全部 -
not选择器注意元素输入格式
div:not([class="55555"])
选择内容为空的元素
查看全部 -
点击a标签里的链接 获取#brand 再用target将样式给到id为brand的元素里的内容
#brand:target
查看全部 -
odd:奇数
even:偶数
n----xn-y或者1 2 3 4 5 6......
查看全部 -
多个子元素选择器:nth-child(n)-----注意元素格式输入
ol li:nth-child(n){
}
查看全部 -
<!doctype html><html><head> <meta charset="UTF-8"> <title>制作3D旋转导航</title> <style> @import url("http://www.w3cplus.com/demo/css3/base.css"); /*任务一:引入本地字体文件*/ @font-face { font-family: 'sansationregular'; src: url('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/sansation_regular-webfont.eot'); src: url('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/sansation_regular-webfont.eot?#iefix') format('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/embedded-opentype'), url('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/sansation_regular-webfont.woff') format('woff'), url('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/sansation_regular-webfont.ttf') format('truetype'), url('https://www.w3cplus.com/demo/css3/3DAnimationDropdownMenu/sansation_regular-webfont.svg#sansationregular') format('svg'); font-weight: normal; font-style: normal; } body { background-color: #edecec; } /* basic menu styles */ .nav-menu { display: block; background: #74adaa; width: 950px; margin: 50px auto 150px; } .nav-menu>li { display: inline; float: left; border-right: 1px solid #94c0be; } .nav-menu>li:last-child { border-right: none; } .nav-menu li a { color: #fff; display: block; text-decoration: none; /*调用本地字体*/ font-family: 'sansationregular'; -webkit-font-smoothing: antialiased; -moz-font-smoothing: antialiased; font-smoothing: antialiased; text-transform: capitalize; overflow: visible; line-height: 20px; font-size: 20px; padding: 15px 30px 15px 31px; } .three-d { /* 任务三、设置3D舞台布景 */ /*任务四、设置3D舞台布景过渡效果*/ perspective: 200px; transition: all 0.07s linear; position: relative; } .three-d:not(.active):hover { cursor: pointer; } /*任务五、给不是当前状态的3D舞台的悬浮与聚焦状态设置变形效果*/ .three-d:not(.active):hover .three-d-box, .three-d:not(.active):focus .three-d-box { transform: translateZ(-25px) rotateX(90deg); } .three-d-box { /*任务六、给3D舞台中“.three-d-box”设置过渡与变形效果*/ transform-style: preserve-3d; pointer-events: none; transform: translateZ(-25px); transition: all 0.3s ease-out; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -ms-transform-style: preserve-3d; -o-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-pointer-events: none; -moz-pointer-events: none; -ms-pointer-events: none; -o-pointer-events: none; pointer-events: none; position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; } /*任务七、给导航设置3D前,与3D后变形效果*/ .front { transform: rotateX(0deg) translateZ(25px); } .back { transform: rotateX(-90deg) translateZ(25px); color: #FFE7C4; } .front, .back { display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0; background: #74adaa; padding: 15px 30px 15px 31px; color: white; -webkit-pointer-events: none; -moz-pointer-events: none; -ms-pointer-events: none; -o-pointer-events: none; pointer-events: none; -webkit-box-sizing: border-box; box-sizing: border-box; } /*任务八、设置导航当前状态与悬浮状态下的背景效果*/ .nav-menu li .active .front, .nav-menu li .active .back, .nav-menu li a:hover .front, .nav-menu li a:hover .back { background-color: #51938f; -webkit-background-size: 5px 5px; background-size: 5px 5px; background-position: 0 0, 30px 30px; background-image: linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480); } .nav-menu ul { list-style: none; position: absolute; text-align: left; margin-left: -40px; font-size: 14px; width: 200px; -webkit-transition: all 0.3s ease-in; -moz-transition: all 0.3s ease-in; -ms-transition: all 0.3s ease-in; -o-transition: all 0.3s ease-in; transition: all 0.3s ease-in; -webkit-transform-origin: 0px 0px; -moz-transform-origin: 0px 0px; -ms-transform-origin: 0px 0px; -o-transform-origin: 0px 0px; transform-origin: 0px 0px; -webkit-transform: rotateX(-90deg); -moz-transform: rotateX(-90deg); -ms-transform: rotateX(-90deg); -o-transform: rotateX(-90deg); transform: rotateX(-90deg); -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; -ms-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden; } /*任务九、显示下拉导航菜单,并其设置一个变形效果*/ .nav-menu>li:hover ul { display: block; transform: rotateX(0deg); } </style></head><body> <div id="nav"> <ul class="nav-menu clearfix unstyled"> <li><a href="#" class="three-d active">Home<span class="three-d-box"><span class="front">Home</span><span class="back">Home</span></span></a></li> <li><a href="#" class="three-d">Services<span class="three-d-box"><span class="front">Services</span><span class="back">Services</span></span></a></li> <li><a href="#" class="three-d">Products<span class="three-d-box"><span class="front">Products</span><span class="back">Products</span></span></a></li> <li><a href="#" class="three-d">About<span class="three-d-box"><span class="front">About</span><span class="back">About</span></span></a></li> <li><a href="#" class="three-d">Contact<span class="three-d-box"><span class="front">Contact</span><span class="back">Contact</span></span></a></li> <li><a href="#" class="three-d">Blog<span class="three-d-box"><span class="front">Blog</span><span class="back">Blog</span></span></a> <ul class="clearfix unstyled drop-menu"> <li><a href="#" class="three-d">Html5<span class="three-d-box"><span class="front">Html5</span><span class="back">Html5</span></span></a></li> <li><a href="#" class="three-d">Css3<span class="three-d-box"><span class="front">Css3</span><span class="back">Css3</span></span></a></li> <li><a href="#" class="three-d">JavaScript<span class="three-d-box"><span class="front">JavaScript</span><span class="back">JavaScript</span></span></a></li> <li><a href="#" class="three-d">Videogames<span class="three-d-box"><span class="front">Videogames</span><span class="back">Videogames</span></span></a></li> </ul> </li> <li><a href="#" class="three-d">Shop On-line<span class="three-d-box"><span class="front">Shop On-line</span><span class="back">Shop On-line</span></span></a></li> </ul> </div></body></html>
查看全部 -
2——4
CSS3边框 为边框应用图片 border-image
查看全部
举报