1
我有一個容器(.homepage-section
),裏面可能有多達三個.widget
的。根據.homepage-section
裏面有多少個.widget
,我想要改變寬度。基於子女數量的款式
我遵循Lea Verou(link)概述的方法,但沒有成功。
這裏的SASS功能我已經寫了(到目前爲止):
.widget {
@for $i from 1 through 3 {
&:first-of-type:nth-last-of-type(#{$i}),
&:first-of-type:nth-last-of-type(#{$i}) ~ .widget {
width: (1000px/#{$i});
}
}
}
http://codepen.io/anon/pen/BKwte