在此FIDDLE如果我有其他 child ,我该如何选择第一个 child ?
<div class="root">
<div>5</div>
<div class="child">1</div> // i want this one
</div>
<div class="root">
<div class="child">2</div>
</div>
<div class="root">
<div class="child">3</div>
</div>
我在下面尝试了这个 css 但它不起作用
.root:first-of-type .child:first-of-type {
color: red;
}
最佳答案
关于css - 选择类型的第一个 child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29022318/