Challenge - 5 Problems
CSS Size Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why use variables in Sass to reduce CSS size?
Using variables in Sass helps reduce the compiled CSS size because:
Attempts:
2 left
💡 Hint
Think about how repeating the same value many times affects file size.
✗ Incorrect
Variables let you write a value once and reuse it many times. This helps the Sass compiler avoid repeating long values multiple times in the output CSS, reducing the file size.
📝 Syntax
intermediate2:00remaining
What is the output CSS from this Sass code?
Given this Sass code, what is the compiled CSS output?
SASS
$primary-color: #3498db; .button { color: $primary-color; border: 1px solid $primary-color; }
Attempts:
2 left
💡 Hint
Sass replaces variables with their values in the compiled CSS.
✗ Incorrect
The Sass compiler replaces $primary-color with its value #3498db in the output CSS.
❓ selector
advanced2:00remaining
Which Sass selector nesting reduces compiled CSS size the most?
Consider these Sass snippets. Which one produces the smallest compiled CSS?
Attempts:
2 left
💡 Hint
Look at how nesting affects the selectors in the compiled CSS.
✗ Incorrect
Option B compiles to two simple selectors with the .nav class prefix, avoiding unnecessary nesting or child selectors, resulting in smaller CSS.
❓ layout
advanced2:00remaining
How does using Flexbox in Sass affect compiled CSS size?
Which statement about using Flexbox properties in Sass to reduce CSS size is true?
Attempts:
2 left
💡 Hint
Think about how shorthand properties work in CSS.
✗ Incorrect
Flexbox shorthand properties like flex combine multiple settings into one line, reducing the total CSS size.
❓ accessibility
expert3:00remaining
Which Sass approach best supports accessible color contrast while minimizing CSS size?
You want to ensure text colors meet accessibility contrast standards but keep your compiled CSS small. Which Sass method is best?
Attempts:
2 left
💡 Hint
Think about reusing values and dynamic adjustments in Sass.
✗ Incorrect
Using variables with Sass functions to adjust colors dynamically allows you to maintain accessibility while reusing code, which keeps the compiled CSS smaller.