Simple Example of sass
Advertisements
Simple Example of sass
Here we discuss about how to create sass code and it's relative Html code. In case of SASS code two file (Html file and .scss file) is created by developer and .css file is automatically created.
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>
Next step create style.scss file which is similar to .css file but difference between them is sass file is save with .scss extension and css file save with .css.
Example of sass scss file
h1 { font:size: 22px; color: green; } h3 { font:size: 18px; color: red; } p { font:size: 14px; }
Execute scss code
To execute scss code follow these steps;
- Open command promp
- Type command: sass --watch style.scss:style.css
When you excute style.scss code i will automatically create style.css file inside rood directory. Whenever you change the SCSS file, the style.css file will changed automatically. style.css file have following code;
At last when you execute html code it will read css file and the output would be like below;
Google Advertisment