Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建一个像这样运行的 SASS mixin:
@include custom-horiz-sep(7);
这将输出CSS:
content: "xxxxxxx";
(7 个预定义字符)
如何在 SASS 中使用“for”循环来为“content”属性创建值?
在 bookcasey 和 cimmanon 的帮助下,这似乎很有效:
@mixin custom-horiz-sep($num) { $chr: "x"; $content: $chr; @for $i from 0 to $num { $content: $content + $chr; } content: "#{$content}"; } h1:before { @include custom-horiz-sep(25); }
http://codepen.io/Protohominid/pen/rgzKF