0
0
Tailwindmarkup~20 mins

Custom breakpoints in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Custom Breakpoints Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2: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?
Amodule.exports = { screens: { tablet: '640px' } }
Bmodule.exports = { theme: { extend: { screens: { tablet: '640px' } } } }
Cmodule.exports = { theme: { screens: { tablet: '640px' } } }
Dmodule.exports = { extend: { screens: { tablet: '640px' } } }
Attempts:
2 left
💡 Hint
Custom breakpoints go inside theme.extend.screens to avoid overwriting defaults.
rendering
intermediate
2: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?
AApply background red on all screen sizes
BApply background red only on screens smaller than 640px
CApply background red only on screens 640px and wider
DCause an error because <code>tablet</code> is not a default breakpoint
Attempts:
2 left
💡 Hint
Tailwind applies breakpoint classes from the specified width and up.
selector
advanced
2: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?
A@media (min-width: 641px) { .tablet\:text-center { text-align: center; } }
B@media (max-width: 640px) { .tablet\:text-center { text-align: center; } }
C.tablet\:text-center { text-align: center; }
D@media (min-width: 640px) { .tablet\:text-center { text-align: center; } }
Attempts:
2 left
💡 Hint
Tailwind uses min-width media queries for breakpoints.
layout
advanced
2: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?
Agrid grid-cols-2 desktop:grid-cols-4
Bgrid grid-cols-4 desktop:grid-cols-2
Cgrid-cols-2 grid-cols-desktop-4
Dgrid-cols-2 grid desktop:grid-cols-4
Attempts:
2 left
💡 Hint
Use grid to enable grid layout and breakpoint prefix before the class.
accessibility
expert
2: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?
AUse <code>text-gray-400 wide:text-gray-900</code> so text is darker on wide screens
BUse <code>text-gray-900 wide:text-gray-400</code> and test contrast on wide screens
CUse <code>text-gray-900 wide:text-gray-400</code> without testing contrast
DUse <code>text-gray-400</code> only, ignoring breakpoints
Attempts:
2 left
💡 Hint
Darker text usually has better contrast on light backgrounds.