Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a SASS variable for a primary color.
SASS
$primary-color: [1]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $
Using plain words instead of color codes
✗ Incorrect
In SASS, variables start with a $ and are assigned values like colors using hex codes.
2fill in blank
mediumComplete the code to nest CSS selectors in SASS.
SASS
.button {
color: white;
&:[1] {
background-color: blue;
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' which is not a CSS pseudo-class
Confusing 'active' and 'hover'
✗ Incorrect
In SASS, &:hover is used to style the hover state of an element.
3fill in blank
hardFix the error in the CSS-in-JS style object to correctly set the background color.
SASS
const styles = {
container: {
backgroundColor: [1]
}
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around color values
Using CSS syntax inside JS objects
✗ Incorrect
In CSS-in-JS, color values must be strings, so use quotes around the color name.
4fill in blank
hardFill both blanks to create a SASS mixin and use it in a class.
SASS
@mixin [1]($color) { color: $color; } .text { @include [2](red); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase names in SASS mixins
Mismatching mixin names between definition and usage
✗ Incorrect
A SASS mixin is defined with @mixin and included with @include. The same name must be used for both.
5fill in blank
hardFill all three blanks to create a CSS-in-JS style with a hover effect.
SASS
const styles = {
button: {
backgroundColor: [1],
color: [2],
'&:[3]': {
backgroundColor: 'darkblue'
}
}
}; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around colors
Using CSS syntax instead of JS object keys for hover
✗ Incorrect
In CSS-in-JS, colors are strings and hover styles use the &:hover selector as a key.