【发布时间】:2014-09-21 01:14:55
【问题描述】:
我有一个容器 (.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});
}
}
}
【问题讨论】: