CSS3选择器(四)结构性伪类7
DIV+CSS 2010/12/16 14:10:35 点击:不统计
<网f站o学a习s制p作.cn>
第十九节:CSS3选择器之:结构性伪类 E:first-of-type
语法:
E:first-of-type :{attribute}
相关伪类:E:root | E:nth-child | E:nth-last-child | E:nth-of-type | E:nth-last-of-type | E:last-child | E:only-child | E:only-of-type | E:empty
说明:
匹配同级兄弟中的第一个E元素
兼容性:
Firefox3.5,Chrome1.0,Chrome2.0,Opera9.63,Safari3.1,Safari 4Public beta
代码示例:
<style type="text/css">
p:first-of-type {color:#FF0000;}
</style>
<div style="width:733px; border: 1px solid #666; padding:5px;">
<p>匹配同级兄弟中的第一个E元素,这里的字的颜色被设置成了红色</p>
<p>匹配同级兄弟中的第一个E元素,这里的字的颜色是黑色的</p>
<p>匹配同级兄弟中的第一个E元素,这里的字的颜色是黑色的</p>
<p>匹配同级兄弟中的第一个E元素,这里的字的颜色是黑色的</p>
</div>
http://%77%77%77%2E%66网站制作%6F学习网%72%61%73%70%2E%63%6E
·上一篇:CSS3选择器(四)结构性伪类6 >> ·下一篇:CSS3选择器(四)结构性伪类8 >>