All Tracks/sass/
Đang tải...
Hướng dẫn thử thách
1 / 9

Store Data with Sass Variables

One feature of Sass that's different than CSS is it uses variables. They are declared and set to store data, similar to JavaScript. In JavaScript, variables are defined using the `let` and `const` keywords. In Sass, variables start with a `$` followed by the variable name. Here are a couple examples: ```scss $main-fonts: Arial, sans-serif; $headings-color: green; ``` And to use the variables: ```scss h1 { font-family: $main-fonts; color: $headings-color; } ``` One example where variables are useful is when a number of elements need to be the same color. If that color is changed, the only place to edit the code is the variable value. # --instructions-- Create a variable `$text-color` and set it to `red`. Then change the value of the `color` property for the `.blog-post` and `h2` to the `$text-color` variable.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.html
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.