1. 声明并引入变量
~~~
$nav-color: #F90;
$highlight-border: 1px solid $highlight-color;
nav {
$width: 100px;
width: $width;
color: $nav-color;
border: $highlight-border;
}
//编译后
nav {
width: 100px;
color: #F90;
border: 1px solid #F90;
}
~~~
2. CSS属性的嵌套
~~~
#content {
article {
h1 { color: #333 }
p { margin-bottom: 1.4em }
}
aside { background-color: #EEE }
}
//编译后
#content article h1 { color: #333 }
#content article p { margin-bottom: 1.4em }
#content aside { background-color: #EEE }
~~~