我需要将数字转换为单词,所以:
这些数字是在一个循环中产生的,它应输出一群不同的类名等的one-third或one-half:
$number = 3;
@for $i from 1 through $number-1 {
// some calculations to output those classes: ".one-third", ".two-thirds"
// The following currently outputs class names like ".1-3" and ".2-3"
.#{$i}-#{$number} {
// CSS styles
}
}
Run Code Online (Sandbox Code Playgroud)
我想我需要使用两个不同的关联数组,在PHP中(仅作为示例)可能看起来像:
$1 = array(
"1"=>"one",
"2"=>"two",
"3"=>"three"
);
$2 = array(
"1"=>"whole",
"2"=>"half",
"3"=>"third"
);
Run Code Online (Sandbox Code Playgroud)
是否可以在SASS/SCSS中创建关联数组或是否有任何解决方法?