Nesting

Using Sass, you can nest CSS rules within each other. Sass is not only easier to read, but it helps to avoid a lot of duplication of the CSS selectors. This is especially true for highly-nested CSS rules. Let's look at a simple example:

/* Here is some basic Sass that uses nesting */

#outer-frame p {
color: #ccc;
width: 90%;
.danger-box {
background-color: #ff0000;
color: #fff;
}
}

The preceding Sass code will be compiled and the equivalent CSS code will be generated:

/* This is the CSS that the above Sass is compiled to */

#outer-frame p {
color: #ccc;
width: 90%;
}
#outer-frame p .danger-box {
background-color: #ff0000;
color: #fff;
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.3.72