我需要将数字转换为单词,所以:
"1-3" - >"三分之一"
"3-3" - >"三分之三"
"2-5" - >"五分之二"
这些数字是在一个循环中产生的,它应输出一群不同的类名等的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 } }
我想我需要使用两个不同的关联数组,在PHP中(仅作为示例)可能看起来像:
$1 = array( "1"=>"one", "2"=>"two", "3"=>"three" ); $2 = array( "1"=>"whole", "2"=>"half", "3"=>"third" );
是否可以在SASS/SCSS中创建关联数组或是否有任何解决方法?