我知道 last-child 是它 parent 的最后一个 child 。
<div class"parent">
<div class="child a"></div>
<div class="child b"></div>
<div class="child c"></div>
<div class="child d"></div>
<div class="child d"></div>
<div class="child d"></div>
<div class="child d"></div>
<div class="child e"></div>
</div>
这里,
.child:last-child{
/*This will grab .child.e as it's the last child of it's parent*/
}
我想使用 :last-child
选择器选择最后一个 .child.d
。 (最后一个 .child
有 d
类)?
什么是 CSS 选择器? (请不要使用 Javascript!)
最佳答案
:last-of-type
对我不起作用
我正在写 postCSS。由于某种原因,这不起作用
.roomOffered{
&__single{
border-bottom: 1px solid $color__skipper--fade3;
padding: 3.5rem 0 3rem;
margin-bottom: 0;
&:last-of-type{
border-bottom: none;
}
}
}
最后一个 .roomOffered__single
的 border-bottom 没有被移除!!
关于html - CSS- :last-child that has "xyz" class name selector? 纯 CSS/LESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37031554/