Sass Relational Operators

Last Updated:

What is Relational Operators?

Relational operators returns a Boolean value indicates whether numbers are greater than, Less than, greater than or equal to, or less than or equal to one another.

Example

SASS TO CSS CONVERTER
//Check your console @debug 1px > 1in; // false @debug 20px < 24px; // true @debug 9ms >= 55ms; // false @debug 999ms <= 1s; // true

Sass Relational Operators

The following table provides a list of relational operators available in Sass.

OperatorExplanationOperationResult
> Greater than 1px > 1in false
< Less than 20px < 24px true
>= Greater than or equal to 9ms >= 55ms false
<= Less than or equal to 999ms <= 1s true

Relational Operators using Incompatible Units

Numbers with incompatible units can’t be compared.

Example

SASS TO CSS CONVERTER
//Check your console @debug 1px > 1s; // Error

Share this Page

Meet the Author