语法:
@while <expression> { ... }
SCSS
/// Divides `$value` by `$ratio` until it's below `$base`.
@function scale-below($value, $base, $ratio: 1.618) {
@while $value > $base {
$value: $value / $ratio;
}
@return $value;
}
$normal-font-size: 16px;
sup {
font-size: scale-below(20px, 16px);
}
编译为 CSS 结果:
CSS
sup {
font-size: 12.36094px;
}
分享笔记