- Sass Tutorial
- Sass - Home
- Sass - Overview
- Sass - Installation
- Sass - Syntax
- Using Sass
- Sass - CSS Extensions
- Sass - Comments
- Sass - Script
- Sass - @-Rules and Directives
- Control Directives & Expressions
- Sass - Mixin Directives
- Sass - Function Directives
- Sass - Output Style
- Extending Sass
- Sass Useful Resources
- Sass - Interview Questions
- Sass - Quick Guide
- Sass - Useful Resources
- Sass - Discussion
Sass - @if Directive
Description
The @if directive is used to selectively execute the code statements based on the result of evaluating an expression. The @if statements can be followed by several @else if statements. Let us study them from the table given below −
S. No. | Types & Description |
---|---|
1 | @if
It accepts SassScript expressions and uses the nested styles whenever the result of the expression is anything other than false or null. |
2 | @else if
It is used with the @if directive, whenever the @if statement fails then the @else if statements are tried and if they also fails then the @else is executed. |
sass_control_directives_expressions.htm
Advertisements
To Continue Learning Please Login
Login with Google