Sass Operators

Overview
What You’ll Learn
Sass operators work on values at compile time. Compare values, do math with units, join strings, and combine conditions with and, or, and not.
SCSS
$width: 600px;
.box {
width: $width * 2; // numeric
content: "Hello, " + "Sass"; // string
}
@if $width > 500px and not false { // relational + boolean
.wide { display: block; }
} Index
Operator Index
Operators
Compare, calculate, join, and combine.
Frequently Asked Questions
Operators combine or compare values while Sass compiles, such as ==, <, +, *, and, or, and not.
Slash division is deprecated. Use math.div() or calc() instead. See the numeric operators and math.div tutorials.
Use == and != for equality, and <, <=, >, >= for numbers with compatible units.
Yes, with +. The result keeps the quotes of the left operand.
Start with equality, then numeric and boolean operators.
Next: Sass Equality Operators
Start with the first tutorial in this section.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful
