.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吗?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这样才能选择上第2个.box2