相关疑难解决方法(0)

CSS3选择器:具有类名的第一个类型?

是否可以使用CSS3选择器: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}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)

css css-selectors css3

213
推荐指数
6
解决办法
16万
查看次数

CSS选择具有特定类的第一个元素

选择具有某个类的第一个元素的语法是什么?请指定该选择方法是否是CSS3或CSS2.1的一部分.

css css-selectors css3

14
推荐指数
2
解决办法
1万
查看次数

标签 统计

css ×2

css-selectors ×2

css3 ×2