Test your knowledge of fundamental SCSS concepts, syntax, and features with this short quiz designed for beginners.
SCSS Variable Declaration
Which of the following is the correct way to declare a variable in SCSS?
- var $primary-color = #3498db;
- primary-color: #3498db;
- $primary-color: #3498db;
- $primary-color #3498db;
- @primary-color = #3498db;
Nesting Selectors
Given the following SCSS code: '.container { .item { color: red; } }', what does it compile to in CSS?
- .container u003E .item { color: red; }
- .container-item { color: red; }
- .container, .item { color: red; }
- .container .item .color-red {}
- .container .item { color: red; }
SCSS @mixin Syntax
What is the correct syntax for declaring a mixin in SCSS for reusable styles?
- #mixin rounded-corner { border-radius: 5px; }
- @mix rounded-corner { border-radius: 5px; }
- @mixin: rounded-corner { border-radius: 5px; }
- @mixin rounded-corner { border-radius: 5px; }
- mixin rounded-corner { border-radius: 5px; }
Using SCSS @import
How do you import another SCSS file named '_variables.scss' into your current stylesheet?
- #import 'variables';
- import 'variables';
- @import 'variables';
- @import variables.scss;
- @import '_variables';
Interpolation in SCSS
Which option shows the correct way to use interpolation to create dynamic selector names in SCSS?
- .icon-$(name) { color: blue; }
- .icon-$[name] { color: blue; }
- .icon-${name} { color: blue; }
- .icon-@{name} { color: blue; }
- .icon-#{$name} { color: blue; }