scss代码css
.funky { font: { family: fantasy; size: 30em; weight: bold; } }
编辑后的代码数组
.funky { font-family: fantasy; font-size: 30em; font-weight: bold; }
固然也能够带包含本身的属性(目前尚未想到什么用的到的地方)ide
.funky { font: 20px/24px { family: fantasy; weight: bold; } } /*编译后的代码*/ .funky { font: 20px/24px; font-family: fantasy; font-weight: bold; }
#main { $width: 5em !global; width: $width; } #sidebar { width: $width; } /*编译结果*/ #main { width: 5em; } #sidebar { width: 5em; }
p { font: 10px/8px; // 不是运算符,起到分隔符的做用 $width: 1000px; width: $width/2; // 使用了变量 width: round(1.5)/2; // 使用了函数,切函数有数字类型返回值 height: (500px/2); // 使用了圆括号 margin-left: 5px + 8px/2px; // 使用了+号,是算数表达式的一部分 }
p { $font-size: 12px; $line-height: 30px; font: #{$font-size}/#{$line-height}; } p { font: 12px/30px; }
p { color: #010203 * 2; } P{ color: #020406; } /* 分段运算 01 * 2 = 02 02 * 2 = 04 03 * 2 = 06 */
// demo1: p:before{ content: test + '测试'; } // 编译 p:before{ content: test测试; } // demo2 p:before{ content: '测试' + test; } // 编译 p:before{ content: '测试test'; }
$test: '测试' p:before { content: "I ate #{5 + 10} pies!"; } p:after { content: "I ate #{$test} pies!"; } // 编译 p:before { content: "I ate 15 pies!"; } p:after { content: "I ate 测试 pies!"; }