【怎么建立自己的网站】
其中,E表示网页元素,nth-child(n)表示第聆个子元素,att表示元素的属性。示例代码如卞
.txtnthcldf }
width:233px; /+父元素的样式txtnthcld*/
)
.txtnthcld p{
color:#099;
)
.txtnthcld p:nth-child(3){
color:#ff0000; /+作用于父元素中第3个子元素+/
}
应用此样式的代码如下:
<ul class="txtnthcld">
<p>我们是一起的</p>
<p>不得变成红的</p>
<p>我是第三个,我要变红求关注</p>
</ul>
浏览器中的浏览效果如图6-9所示。
图6-8 E:root选择符 <!..套用父元素的样式txtnthcld..> <!.,父元素中的第3个子元素..> (3) E:nth-last-child(n)结构性伪类选择符 E:nth-last-child(n)结构性伪类选择符用于匹配父元素中的倒数第,z个结构子元素E。其j 式为: E:nth-Iast-child(n): [att] { /*CSS代码*, } 其中,E表示网页元素,nth-last-child(n)表示倒数第,2个子元素,att表示元素的属性。示例1 码如下: ·106. .txtnthcld f width:233px; } .txtnthcld p{ color:#099; } .txtnthcld p:nth-last-child(3){ color:#ff0000; } |
本文地址:
http://www.yishenzhou.com/yes/post/377.html | 分类:整合营销 |
次阅读