Challenge - 5 Problems
Custom Breakpoints Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
Defining a custom breakpoint in Tailwind CSS
Which of the following
tailwind.config.js snippets correctly defines a custom breakpoint named tablet at 640px?Attempts:
2 left
💡 Hint
Custom breakpoints go inside
theme.extend.screens to avoid overwriting defaults.✗ Incorrect
To add a custom breakpoint without removing default ones, you must put it inside
theme.extend.screens. Option B does this correctly. Option B overwrites the whole config and misses theme. Option B overwrites default screens. Option B misses theme level.❓ rendering
intermediate2:00remaining
Effect of custom breakpoint on responsive classes
Given this custom breakpoint
tablet: '640px' added correctly, what will the class tablet:bg-red-500 do?Attempts:
2 left
💡 Hint
Tailwind applies breakpoint classes from the specified width and up.
✗ Incorrect
Custom breakpoints behave like default ones. The class
tablet:bg-red-500 applies the red background starting at 640px width and up. It does not apply below 640px. It does not cause errors if defined properly.❓ selector
advanced2:00remaining
Using custom breakpoint in Tailwind CSS selectors
Which CSS selector does Tailwind generate for the class
tablet:text-center if tablet is defined as 640px?Attempts:
2 left
💡 Hint
Tailwind uses min-width media queries for breakpoints.
✗ Incorrect
Tailwind generates media queries with min-width equal to the breakpoint value. So for 640px, it uses @media (min-width: 640px). Option D matches this. Option D uses max-width which is incorrect. Option D has no media query. Option D uses 641px which is off by one.
❓ layout
advanced2:00remaining
Responsive grid layout with custom breakpoints
You want a grid with 2 columns on small screens and 4 columns on your custom breakpoint
desktop at 1024px. Which Tailwind classes achieve this?Attempts:
2 left
💡 Hint
Use
grid to enable grid layout and breakpoint prefix before the class.✗ Incorrect
Option A correctly sets grid layout with 2 columns by default and 4 columns at desktop breakpoint. Option A has wrong class order but works similarly, but
grid-cols-2 must come with grid. Option A uses invalid class grid-cols-desktop-4. Option A reverses columns count.❓ accessibility
expert2:00remaining
Ensuring accessible color contrast with custom breakpoints
You define a custom breakpoint
wide at 1440px. You want text color to be text-gray-900 normally and text-gray-400 on wide screens. What is the best way to ensure good color contrast for accessibility?Attempts:
2 left
💡 Hint
Darker text usually has better contrast on light backgrounds.
✗ Incorrect
Option A ensures text is darker on wide screens, improving readability. Option A makes text lighter on wide screens, which may reduce contrast. Option A ignores testing contrast, which is important. Option A ignores responsiveness.