QuizzesCustom Properties and Theming — Concept Check
intermediate
html-css

Custom Properties and Theming — Concept Check

Questions on Custom Properties and Theming. CSS variables are live values that inherit and cascade, which makes theming, dark mode and component variants a matter of redefining tokens rather than rewriting rules.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Custom Properties and Theming — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer wants to implement a dark mode for their website using CSS. How should they redefine the background color for dark mode?

    • AUse JavaScript to toggle a dark class on the body
    • BUse a media query with prefers-color-scheme: dark
    • CChange the background color directly in the CSS file
    • DSet a global variable for dark mode
  2. 2.You have a CSS variable --color-accent defined at the root. What happens if you redefine --color-accent inside a .card component?

    • AOnly the .card component uses the new value
    • BThe new value is ignored
    • CThe new value applies globally
    • DAll components inherit the new value
  3. 3.A website uses CSS variables for theming. What is a potential issue if a color is defined only inside a media query?

    • AColor will not change on theme switch
    • BColor will apply globally
    • CColor might be undefined for users not matching the media query
    • DColor will override all other styles
  4. 4.In a theming system using CSS variables, why is it beneficial to define semantic tokens at the root?

    • AAllows easy theme switching without changing component CSS
    • BImproves CSS parsing speed
    • CReduces CSS file size
    • DPrevents CSS specificity issues
  5. 5.A developer uses JavaScript to set document.documentElement.dataset.theme = 'dark'. What is the effect?

    • AHas no effect without a matching CSS rule
    • BOverrides all CSS variables
    • CExplicitly sets the theme to dark regardless of system settings
    • DChanges the theme based on system preferences
  6. 6.When using CSS variables, how can you ensure that a component adapts to different screen sizes?

    • ACreate separate CSS files for each size
    • BUse inline styles for each size
    • CManually adjust styles with JavaScript
    • DDefine variables within a media query
  7. 7.What is the advantage of using @property in CSS?

    • AAllows CSS variables to animate
    • BImproves CSS parsing speed
    • CReduces CSS file size
    • DPrevents CSS specificity issues