Select Page

Nesting is one of my favorite features Sass has to offer. I hate clunky code. I hate it when I have to inline state nav ul li to access that navigation’s element’s hover property. First of all, I find it highly unreadable. Second, I find it hard to actually read and find things I need.


Sass allows you to nest the elements, quite similar to how you’d organize your HTML. You’d “nest” certain elements under it’s “parent” and you will immediately gain much better visibility of the code at hand. Let’s have a look at the example:

Notice we’re “indenting” just as we would indent elements in the HTML:

Only difference is, we’re following the CSS code convention, of course.

Let’s run the compiler and see what we’ll get:

Hopefully you can see how Nesting can save your sanity in CSS coding. In the end, all code will be minified and reduced to smallest size it can, and you’re the one who needs to write/read it now. Why not make yourself a favor and make it super readable with Nesting? 🙂

Cheers! Until next time!

Share This