Tutorial

Sass Variables

While this tutorial has content that we believe is of great benefit to our community, we have not yet tested or edited it to ensure you have an error-free learning experience. It's on our list, and we're working on it! You can help us out by using the "report an issue" button at the bottom of the tutorial.

Use variables in Sass to save and reuse values throughout your code:

$box-bgcolor: #FF8100;
$box-border: 4px dashed yellow;

.box {
  background-color: $box-bgcolor;
  border: $box-border;
}

Result

The above snippet will yield the following CSS:

.box {
  background-color: #FF8100;
  border: 4px dashed yellow;
}

0 Comments

Creative Commons License