April 2013
Intermediate to advanced
274 pages
5h 39m
English
In Chapter 1, Getting started with Sass and Compass, we looked briefly at nesting. It provides the ability to nest styles within one another. This provides a handy way to write mini blocks of modular code.
With a normal CSS style declaration, there is a selector, then an opening curly brace, and then any number of property and value pairs, followed by a closing curly brace. For example:
.css {
display: block;
}Where Sass differs is that before the closing curly brace, you can nest another rule within. What do I mean by that? Consider this example:
a {
color: $color7;
&:hover,&:focus {
color: $color5;
}
&:visited,&:active {
color: $color4;
}
}In the previous code, a color has been ...
Read now
Unlock full access