How to define variable in LESS ?

Answer

Less allows variables to be defined. Less variables are defined with an at sign(@). Variable assiment is done with a Colon (:).

During translation, the values of the variables are inserted into the output CSS document.

@varcolor: #ccc;
 
#header {
  color: @varcolor;
}
h2 {
  color: @varcolor;
}

The code above in Less would compile to the following CSS code.

#header {
  color: #ccc;
}
h2 {
  color: #ccc;
}

 

All less Questions

Ask your interview questions on less

Write Your comment or Questions if you want the answers on less from less Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---