我一直想弄清楚爲什麼我的代碼不能按預期工作。 基本上我想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