Google News
logo
Sass - Interview Questions
What is the use of @extend directive in SASS?
The SASS @extend directive is used to share a set of CSS properties from one selector to another. It is a very important and useful feature of Sass. It allows classes to share a set of properties with one another. It makes your code less and facilitates you to rewrite it repeatedly.

For example :
 .message    
  border: 1px solid #ccc    
  padding: 10px    
  color: #333    
.success    
  @extend .message    
  border-color: green    
.error    
  @extend .message    
  border-color: red    
.warning    
  @extend .message    
  border-color: yellow 

 

Advertisement