文章详情页
css3选择器nth-of-type的问题
浏览:87日期:2023-08-13 13:35:43
问题描述
.content .box2:nth-of-type(2) { background: #fed;}
<div class="content"> <div class="box1">box1</div> <p class="box2">box2</p> <p>text</p> <p class="box2">box2</p></div>
为什么没有选择到任何一个元素,不应该选择到第2个.box2吗?
问题解答
回答1:div > box1 box2
box2 box2这样才能选择上第2个.box2
标签:
CSS
相关文章:
排行榜
