7. Nested Rules
#main {
background-color: #FFCBDB;
color: #666666;
}
.warning {
background-color: #FF0000;
color: #000000;
}
#main {
background-color: #FFCBDB;
color: #666666;
}
#main .warning {
background-color: #FF0000;
color: #000000;
}
Nesting allows you to apply the same clean,
hierarchy-driven visual makeup of HTML to CSS.
8. Variables & Functions
$radyellow: #EEAD0E;
#main {
background-color: $radyellow;
color: darken($radyellow, 30%);
}
#main {
background-color: #EEAD0E;
color: #5e4406;
}
Works with any CSS value
you can think of!
9. Operators
#main {
$localwidth: 500px;
.panel {
width: $localwidth/10;
}
}
#main .panel {
width: 100px;
}
Computing grid-layouts and element placement
is no longer a chore.
Let Sass do the number-crunching for you.
10. Mixins
@mixin atlantafun() {
$atl_peach: #FFD8AD;
background-color: $atl_peach;
}
body {
.view-grid {
@include atlantafun();
}
}
body .view-grid {
background-color: #FFD8AD;
}
Mixins define a group of CSS declarations that
you can reuse throughout your theme. These
mixins can even include arguments.
11. Partials
Partials allow for compartmentalizing
of your CSS into separate Sass files.
file.scss file.css
compilation
magic
_header.scss
_footer.scss