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!"; }