0
0
Tailwindmarkup~20 mins

Extending default theme values in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind Theme Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding theme extension in Tailwind CSS
What happens when you add new colors inside the extend section of the Tailwind theme configuration?
Tailwind
module.exports = {
  theme: {
    extend: {
      colors: {
        brandBlue: '#1fb6ff'
      }
    }
  }
}
AThe new colors replace all the default colors in Tailwind.
BThe new colors are ignored unless you remove the default colors first.
CThe new colors are added alongside the default colors without replacing them.
DTailwind throws an error because colors cannot be extended.
Attempts:
2 left
💡 Hint
Think about how extend works compared to overriding the whole theme.
📝 Syntax
intermediate
2:00remaining
Correct syntax for extending font sizes
Which option correctly extends the default font sizes by adding a new size called xxs with value 0.65rem?
Tailwind
module.exports = {
  theme: {
    extend: {
      fontSize: {
        xxs: '0.65rem'
      }
    }
  }
}
AfontSize: { xxs: '0.65rem' }
BfontSizes: { xxs: '0.65rem' }
CfontSize: ['xxs', '0.65rem']
DfontSize: { 'xxs': 0.65 }
Attempts:
2 left
💡 Hint
Check the exact property name and value format Tailwind expects.
rendering
advanced
2:00remaining
Visual effect of extending spacing scale
If you extend the spacing scale with 72: '18rem' and use class="mt-72" on a div, what will you see?
Tailwind
module.exports = {
  theme: {
    extend: {
      spacing: {
        '72': '18rem'
      }
    }
  }
}
ATailwind will throw an error because spacing keys must be strings, not numbers.
BThe div will have no margin because 72 is not a valid spacing value.
CThe div will have a top margin of 72px instead of 18rem.
DThe div will have a top margin of 18rem, creating a large vertical space above it.
Attempts:
2 left
💡 Hint
Remember how Tailwind spacing keys can be numbers as strings and map to CSS sizes.
selector
advanced
2:00remaining
Using extended colors in Tailwind selectors
After extending the colors with brandRed: '#e3342f', which class applies the background color correctly?
Tailwind
module.exports = {
  theme: {
    extend: {
      colors: {
        brandRed: '#e3342f'
      }
    }
  }
}
Abg-brandRed
Bbackground-brandRed
Cbg-brandred
Dbg-brand-red
Attempts:
2 left
💡 Hint
Tailwind class names are case sensitive and use kebab-case for multi-word names.
accessibility
expert
3:00remaining
Ensuring accessible color contrast with extended theme colors
You extended Tailwind colors with softGreen: '#a8d5ba'. Which approach best ensures text using text-softGreen is accessible on a white background?
Tailwind
module.exports = {
  theme: {
    extend: {
      colors: {
        softGreen: '#a8d5ba'
      }
    }
  }
}
AUse <code>text-softGreen</code> alone; the color is light enough for all users.
BUse <code>font-bold</code> with <code>text-softGreen</code> to increase contrast and readability.
CAdd <code>bg-white</code> and <code>opacity-50</code> to the text to soften the color.
DUse <code>text-softGreen</code> with <code>underline</code> to improve accessibility.
Attempts:
2 left
💡 Hint
Think about how font weight affects color contrast and readability.