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 關注
- 634 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消