© Alex Libby 2019
Alex LibbyIntroducing Dart Sasshttps://doi.org/10.1007/978-1-4842-4372-5_3

3. Creating Nested Styles

Alex Libby1 
(1)
Rugby, Warwickshire, UK
 

If you spend any time writing CSS styles, I have no doubt that sooner or later, you will have come across instances where your code contains selectors or classes that go several levels deep. What do I mean by this? Well, let me explain.

Take, for example, a navigation bar. This has been around for years – it’s a basic staple of websites, although how we decide to skin it will differ between sites. However, the basic principle uses unordered lists, which can go several levels deep:
<nav>
  <li>
    <a href="#">Heading 1</a>
      <ul>
        <li><a href="#">Test link</a></li>
        <li><a href="#">Test ...

Get Introducing Dart Sass: A Practical Introduction to the Replacement for Sass, Built on Dart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.