0
0
CSSmarkup~10 mins

Theme implementation basics in CSS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a CSS variable for the primary color.

CSS
:root { --primary-color: [1]; }
Drag options to blanks, or click blank then click option'
A#3498db
Bprimary-color
Ccolor-primary
Dblue
Attempts:
3 left
💡 Hint
Common Mistakes
Using the variable name as the value instead of a color code.
Using a color name without quotes or hash (#).
2fill in blank
medium

Complete the code to apply the primary color variable to the background of the body.

CSS
body { background-color: var([1]); }
Drag options to blanks, or click blank then click option'
A--primary-color
B--background-color
Cprimary-color
Dbackground-color
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the dashes in the variable name.
Using the variable name without var().
3fill in blank
hard

Fix the error in the CSS code to correctly define a dark theme background color variable.

CSS
@media (prefers-color-scheme: dark) { :root { --background-color: [1]; } }
Drag options to blanks, or click blank then click option'
Ablack
Bdark
C#000000
Dbackground-color
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid color names like 'dark'.
Using the variable name as the value.
4fill in blank
hard

Fill both blanks to create a CSS rule that sets text color using a variable and applies a fallback color.

CSS
p { color: var([1], [2]); }
Drag options to blanks, or click blank then click option'
A--text-color
Bblack
Cwhite
D--background-color
Attempts:
3 left
💡 Hint
Common Mistakes
Using a color name as the variable name.
Omitting the fallback color.
5fill in blank
hard

Fill all three blanks to create a CSS theme with variables for background, text color, and a hover effect color.

CSS
:root { --background: [1]; --text: [2]; --hover: [3]; }
Drag options to blanks, or click blank then click option'
A#ffffff
B#333333
C#555555
D#000000
Attempts:
3 left
💡 Hint
Common Mistakes
Using colors that do not contrast well.
Mixing up the order of colors.