Sass Variables
本文最后更新于:2021年2月19日 晚上
Sass Variables
Partials
Think of variables as a way to store information that you want to reuse throughout your stylesheet. You can store things like colors, font stacks, or any CSS value you think you’ll want to reuse. Sass uses the $
symbol to make something a variable. Here’s an example:
SCSS SYNTAX
1 |
|
CSS OUTPUT
1 |
|
When the Sass is processed, it takes the variables we define for the $font-stack
and $primary-color
and outputs normal CSS with our variable values placed in the CSS. This can be extremely powerful when working with brand colors and keeping them consistent throughout the site.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!