Variable in sass

Advertisements

Prev Tutorial Next Tutorial

Variable in sass

Sass allows variables to be defined. Variables begin with a dollar sign ($). Variable assignment is done with a colon (:). In scss $ sign is used for declare variable and in scss ! sign is used for declare variable.

Declare variable in scss

$my-font:    Helvetica, sans-serif;  
$my-color: red;  
  
body {  
  font: 100% $my-font;  
  color: $my-color;  
}  

Declare variable in sass

!my-font:    Helvetica, sans-serif
!my-color: red
  
body 
  font: 100% $my-font  
  color: $my-color

After processing above code it will automatically genrate sytle.css file in root directory.

css file

  
body {  
  font: 100% Helvetica, sans-serif;
  color: red;  
}  

Example of sass Html file

<html>  
<head>  
   <title>Simple Example of sass</title>  
   <link rel="stylesheet" type="text/css" href="style.css"/>  
</head>  
<body>  
   <h1>Simple Sass Example</h1>  
   <h3>This is my first SASS Code</h3>  
   <p>SASS is very simple and easy to learn and use code.</p>  
</body>
</html>
variable in sass
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements