-
2d/3d转换属性 -ms-transform /* IE 9 */ -moz-transform /* Firefox */ -webkit-transform /* Safari and Chrome */ -o-transform /* Opera */ Internet Explorer 10、Firefox、Opera 支持 transform 属性。 Internet Explorer 9 支持替代的 -ms-transform 属性(仅适用于 2D 转换)。 Safari 和 Chrome 支持替代的 -webkit-transform 属性(3D 和 2D 转换)。 Opera 只支持 2D 转换。 过渡属性 Internet Explorer 10、Firefox、Opera 和 Chrome 支持 transition-property 属性。 Safari 支持替代的 -webkit-transition-property 属性。 Internet Explorer 9 以及更早版本的浏览器不支持 transition-property 属性。 动画 Internet Explorer 10、Firefox 以及 Opera 支持 @keyframes 规则和 animation 属性。 Chrome 和 Safari 需要前缀 -webkit-。 Internet Explorer 9,以及更早的版本,不支持 @keyframe 规则或 animation 属性。查看全部
-
nth-of-type(n)选择器<br> <br> “:nth-of-type(n)”选择器和“:nth-child(n)”选择器非常类似,不同的是它只计算父元素中指定的某种类型的子元素。当某个元素中的子元素不单单是同一种类型的子元素时,使用“:nth-of-type(n)”选择器来定位于父元素中某种类型的子元素是非常方便和有用的。在“:nth-of-type(n)”选择器中的“n”和“:nth-child(n)”选择器中的“n”参数也一样,可以是具体的整数,也可以是表达式,还可以是关键词。 CSS3 background ( rgba_rgb_#hex ) 优雅降级查看全部
-
last-of-type选择器 “:last-of-type”选择器和“:first-of-type”选择器功能是一样的,不同的是他选择是父元素下的某个类型的最后一个子元素。 示例演示 通过“:last-of-type”选择器,将容器“div.wrapper”中最后一个段落元素背景设置为橙色 (提示:这个段落不是“div.wrapper”容器的最后一个子元素)。查看全部
-
目前浏览器都不支持 @keyframes 规则。 Firefox 支持替代的 @-moz-keyframes 规则。 Opera 支持替代的 @-o-keyframes 规则。 Safari 和 Chrome 支持替代的 @-webkit-keyframes 规则。 语法: @keyframes animationname {keyframes-selector {css-styles;}} 参数: animationname 必需。定义动画的名称。 keyframes-selector 必需。动画时长的百分比。 合法的值: 0-100% from(与 0% 相同) to(与 100% 相同) css-styles 必需。一个或多个合法的 CSS 样式属性。查看全部
-
/* :first-of-type */ .wrapper > div:first-of-type { background: orange; } .wrapper > p:first-of-type { background: #000; } .wrapper > pre:first-of-type { background: yellow; } /* :last-of-type */ .wrapper > div:last-of-type { background: #f9f; } .wrapper > p:last-of-type { background: #00f; } .wrapper > pre:last-of-type { background: purple; }查看全部
-
first-of-type选择器 “:first-of-type”选择器类似于“:first-child”选择器,不同之处就是指定了元素的类型,其主要用来定位一个父元素下的某个类型的第一个子元素。 示例演示: 通过“:first-of-type”选择器,定位div容器中的第一个p元素(p不一定是容器中的第一个子元素),并设置其背景色为橙色。 HTML代码: <div class="wrapper"> <div>我是一个块元素,我是.wrapper的第一个子元素</div> <p>我是一个段落元素,我是不是.wrapper的第一个子元素,但是他的第一个段落元素</p> <p>我是一个段落元素</p> <div>我是一个块元素</div> </div> CSS代码: .wrapper { width: 500px; margin: 20px auto; padding: 10px; border: 1px solid #ccc; color: #fff; } .wrapper > div { background: green; } .wrapper > p { background: blue; } /*我要改变第一个段落的背景为橙色*/ .wrapper > p:first-of-type { background: orange; }查看全部
-
结构性伪类选择器—nth-last-child(n) “:nth-last-child(n)”选择器和前面的“:nth-child(n)”选择器非常的相似,只是这里多了一个“last”,所起的作用和“:nth-child(n)”选择器有所区别,从某父元素的最后一个子元素开始计算,来选择特定的元素。 /*odd 奇数*/ ol > li:nth-last-child(2n+1){ background: #f00; } /*even 偶数*/ ol > li:nth-last-child(2n){ background: #000; } /* 倒数 第7个 */ ol > li:nth-last-child(7){ background: #0f0; } /* 倒数 第7个 */ ol > li:nth-last-child(5){ background: orange; }查看全部
-
/*奇数 odd*/ ol > li:nth-child(2n+1){ background: green; } /*偶数 even*/ ol > li:nth-child(2n){ background: red; } /* num 7*/ ol > li:nth-child(7){ background: yellow; }查看全部
-
结构性伪类选择器—last-child “:last-child”选择器与“:first-child”选择器作用类似,不同的是“:last-child”选择器选择的是元素的最后一个子元素。例如,需要改变的是列表中的最后一个“li”的背景色,就可以使用这个选择器, ul>li:last-child{background:blue;} 示例演示 在博客的排版中,每个段落都有15px的margin-bottom,假设不想让博客“post”中最后一个段落不需要底部的margin值,可以使用“:last-child”选择器。 HTML代码: <div class="post"> <p>第一段落</p> <p>第二段落</p> <p>第三段落</p> <p>第四段落</p> <p>第五段落</p> </div> CSS代码: .post { padding: 10px; border: 1px solid #ccc; width: 200px; margin: 20px auto; } .post p { margin:0 0 15px 0; } .post p:last-child { margin-bottom:0; }查看全部
-
ul > li:first-child { color: red; } ul > li:last-child { color: yellow; }查看全部
-
结构性伪类选择器—first-child “:first-child”选择器表示的是选择父元素的第一个子元素的元素E。简单点理解就是选择元素中的第一个子元素,记住是子元素,而不是后代元素。 示例演示 通过“:first-child”选择器定位列表中的第一个列表项,并将序列号颜色变为红色。 HTML代码: <ol> <li><a href="##">Link1</a></li> <li><a href="##">Link2</a></li> <li><a href="##">link3</a></li> </ol> CSS代码: ol > li{ font-size:20px; font-weight: bold; margin-bottom: 10px; } ol a { font-size: 16px; font-weight: normal; } ol > li:first-child{ color: red; }查看全部
-
/* href="#brand" 与 d="brand" 绑定*/ /* :target p*/ :target p{ background: orange; color: #000; } /* :target all*/ :target { background: orange; color: #fff; } /* href="#brand1" 与 d="brand1" 绑定*/ :target { background: orange; color: #fff; } :target h3{ background: red; color: #fff; } :target pre{ background: green; color: #fff; }查看全部
-
/* :target p*/ :target p{ background: orange; color: #fff; } /* :target all*/ /* :target { background: orange; color: #fff; } */查看全部
-
div:empty { display:block; border: 1px solid green; background:linear-gradient(to left bottom,red,black,green,red,blue,yellow,purple); } /*一个div中设置多个背景*/ .div_m{ width:300px; height:95px; background-image: url(http://img1.sycdn.imooc.com//54cf2365000140e600740095.jpg), url(http://img1.sycdn.imooc.com//54cf238a0001728d00740095.jpg), url(http://img1.sycdn.imooc.com//54cf23b60001fd9700740096.jpg); background-position: left top, 100px 0, 200px 0; background-repeat: no-repeat, no-repeat, no-repeat; }查看全部
-
结构性伪类选择器—empty :empty选择器表示的就是空。用来选择没有任何内容的元素,这里没有内容指的是一点内容都没有,哪怕是一个空格。查看全部
举报
0/150
提交
取消