UNPKG

learn-sass

Version:

Learn SASS and SCSS through a workshopper adventure.

46 lines (35 loc) 952 B
# NESTING When writing HTML you've probably noticed that it has a clear nested and visual hierarchy. CSS, on the other hand, doesn't. Here's an example of some typical styles for a site's navigation: ```scss nav { ul { margin: 0; padding: 0; list-style: none; } li { display: inline-block; } a { display: block; padding: 6px 12px; text-decoration: none; } } ``` You'll notice that the ul, li, and a selectors are nested inside the nav selector. This is a great way to organize your CSS and make it more readable. When you generate the CSS you'll get something like this: ```css nav ul { margin: 0; padding: 0; list-style: none; } nav li { display: inline-block; } nav a { display: block; padding: 6px 12px; text-decoration: none; } ``` # EXERCISE Write a stylesheet that sets `margin: 0` to the `ul`, and color of links to `red` for elements contained within an `aside` element, using nesting.