我一直想弄清楚为什么我的代码不能按预期工作。 基本上我想ups img
有width: 60px
和fedex img
有width: 100px
。CSS最后孩子选择所有?
我的标记是:
<div class="delivery-services">
<span>Delivery Services</span>
<br>
<a href="#"><img src="img/fedex.png" alt="fedex" /></a>
<a href="#"><img src="img/ups.png" alt="ups" /></a>
</div>
SCSS是:
.delivery-services {
&:nth-child(3) img {
width: 100px;
}
&:last-child img {
width: 60px;
}
}
但现在看来,这两个IMG被last-child
影响!
请参阅http://stackoverflow.com/questions/15149641/do-i-need-a-at-the-end-of-an-img-or-br-tag-etc关于关闭'img无关的问题'标签。 – 2016-09-23 04:35:47
谢谢,这是笔http://codepen.io/anon/pen/YGNgkj – Jim
好吧,'delivery-services' **是**父母的最后一个孩子。尝试在'&'之后添加空格。Devtools风格的检查员是你的朋友。 – 2016-09-23 04:53:44