Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Sass Syntax | Preprocessors
course content

Course Content

Advanced CSS Techniques

Sass SyntaxSass Syntax

To start writing sass code, we need to create a file with the extension .scss. (e.g., feature.scss).

Let's consider the sass syntax on the following css code. We will manipulate the button that will have some hover effect. We write css code for it:

Let's rewrite the same code into sass syntax:

The difference is that we use styles for one element inside the first pair of the {} brackets. Also, we don't use the element class name twice. We use the ampersand (&) instead.

Note

In case of any questions or misunderstanding of some sass features, it is highly recommended to use sass documentation.

Compilation

Browsers don't understand the preprocessor syntax. It understands only html, css, and javascript syntax. So, how does it work? We need to compile the sass file into the css file. After compilation, we will see the result.

“sass

We have three options to compile sass into css:

Everything was clear?

Section 7. Chapter 2
course content

Course Content

Advanced CSS Techniques

Sass SyntaxSass Syntax

To start writing sass code, we need to create a file with the extension .scss. (e.g., feature.scss).

Let's consider the sass syntax on the following css code. We will manipulate the button that will have some hover effect. We write css code for it:

Let's rewrite the same code into sass syntax:

The difference is that we use styles for one element inside the first pair of the {} brackets. Also, we don't use the element class name twice. We use the ampersand (&) instead.

Note

In case of any questions or misunderstanding of some sass features, it is highly recommended to use sass documentation.

Compilation

Browsers don't understand the preprocessor syntax. It understands only html, css, and javascript syntax. So, how does it work? We need to compile the sass file into the css file. After compilation, we will see the result.

“sass

We have three options to compile sass into css:

Everything was clear?

Section 7. Chapter 2
some-alt