03/15 - SCSS Nesting. What is nesting in sass?

·

1 min read

//html 
/*
<div> hello 
    <p> this is  
        <span> css nesting</span> 
    </p> 
</div>
*/
// scss nesting
div{
  color: red;
  p{
    color: green;
    span{
      color: gray;
    }
  }
}

You can see that every element tags are in a nested position. Instead of putting all tags or selectors separately one by one, we can use these inside the parent selector.