CSS 3选择器:具有类名的第一类型?是否可以使用CSS 3选择器?:first-of-type选择具有给定类名的第一个元素?我的测试还没成功,所以我想不是?守则(http://jsfiddle.net/YWY4L/):p:first-of-type {color:blue}p.myclass1:first-of-type {color:red}.myclass2:first-of-type {color:green}<div> <div>This text should appear as normal</div> <p>This text should be blue.</p> <p class="myclass1">This text should appear red.</p> <p class="myclass2">This text should appear green.</p></div>
3 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
:first-of-type
div
, p
:first-of-class
.myclass1 { color: red; }.myclass1 ~ .myclass1 { color: /* default, or inherited from parent div */; }
- 3 回答
- 0 关注
- 607 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消