Which Tailwind CSS class applies styles only on screens wider than 768px (medium devices and up)?
Alg:text-center
Bmd:text-center
Ctext-center md:text-center
Dtext-center md:
Attempts:
2 left
💡 Hint
Tailwind uses prefixes like md: to apply styles from that breakpoint and up.
✗ Incorrect
The md: prefix applies styles starting at the medium breakpoint (768px). Option B correctly uses md:text-center to center text only on medium screens and larger. Option B is invalid syntax. Option B applies text-center always and again at md, so not only at md. Option B applies styles at large screens (1024px) and up.
❓ layout
intermediate
2:00remaining
Mobile-First Responsive Layout with Tailwind
Given this Tailwind HTML snippet, what will be the width of the div on a small screen (less than 640px)?
Tailwind applies styles without prefixes first, then overrides at breakpoints.
✗ Incorrect
The class w-full applies 100% width by default (mobile first). The sm:w-1/2 applies 50% width starting at 640px, and lg:w-1/4 applies 25% width starting at 1024px. On screens smaller than 640px, only w-full applies.
❓ rendering
advanced
2:00remaining
Visual Result of Mobile-First Flexbox Layout
What will you see on a mobile screen (less than 640px wide) for this Tailwind HTML?
BBoxes side by side horizontally, blue box left, green box right
CBoxes overlap each other
DBoxes stacked vertically, blue box on top, green box below
Attempts:
2 left
💡 Hint
The flex-col class stacks items vertically, and sm:flex-row changes layout on larger screens.
✗ Incorrect
On mobile screens, flex-col applies, stacking boxes vertically. The sm:flex-row applies only on screens 640px and wider, changing layout to horizontal. So on mobile, boxes appear stacked with Box 1 on top.
❓ accessibility
advanced
2:00remaining
Accessibility Considerations in Mobile-First Design
Which practice best improves accessibility for a mobile-first navigation menu using Tailwind CSS?
AUse semantic <nav> element with aria-label and ensure keyboard focus styles are visible
BHide navigation on mobile using display:none without alternative access
CUse only color changes to indicate active menu items without focus styles
DUse <div> elements for navigation without roles or labels
Attempts:
2 left
💡 Hint
Accessibility means everyone can use your site, including keyboard users and screen readers.
✗ Incorrect
Using semantic
🧠 Conceptual
expert
2:00remaining
Why Mobile-First CSS is Preferred in Tailwind
Why does Tailwind CSS use a mobile-first approach for its responsive utilities?
ABecause mobile-first CSS disables styles on desktop by default
BBecause desktop styles override mobile styles by default, making desktop easier to style
CBecause mobile-first CSS loads smaller styles first, improving performance on mobile devices
DBecause mobile-first CSS requires writing more code, which is better for maintainability
Attempts:
2 left
💡 Hint
Think about what devices usually have slower connections and smaller screens.
✗ Incorrect
Mobile-first CSS applies base styles for small screens first, then adds overrides for larger screens. This means mobile devices load only essential styles initially, improving performance. Desktop styles override mobile styles as needed. Options B, C, and D are incorrect or misleading.
Practice
(1/5)
1. What does the mobile-first philosophy mean in web design?
easy
A. Designing for small screens first, then adding styles for larger screens
B. Designing only for desktop screens
C. Designing for large screens first, then adjusting for smaller screens
D. Ignoring screen sizes and using fixed layouts
Solution
Step 1: Understand mobile-first philosophy
Mobile-first means starting design with small screens like phones, then adding styles for bigger screens.
Step 2: Compare options
Only Designing for small screens first, then adding styles for larger screens correctly describes this approach; others describe desktop-first or fixed layouts.
Final Answer:
Designing for small screens first, then adding styles for larger screens -> Option A
Quick Check:
Mobile-first = Start small screens first [OK]
Hint: Mobile-first means start small, then grow bigger [OK]
Common Mistakes:
Thinking mobile-first means designing desktop first
Confusing mobile-first with ignoring screen sizes
Believing mobile-first means only designing for phones
2. Which Tailwind CSS class applies styles only on medium and larger screens?
easy
A. md:bg-blue-500
B. bg-blue-500
C. sm:bg-blue-500
D. lg:bg-blue-500
Solution
Step 1: Understand Tailwind screen prefixes
In Tailwind, md: applies styles at medium screen size and above.
Step 2: Identify correct prefix for medium screens
md:bg-blue-500 uses md:, so it applies on medium and larger screens. Others apply on small, large, or all screens.
A. The order of classes is reversed; it should be text-blue-500 md:text-red-500
B. The md: prefix should be on text-blue-500
C. No error; it works as intended
D. Tailwind does not support multiple text color classes
Solution
Step 1: Understand class application order
Tailwind applies base classes first, then overrides with media prefixes like md:.
Step 2: Check if code matches goal
text-blue-500 applies on all screens, overridden by md:text-red-500 on medium+ screens, matching the goal.
Final Answer:
No error; it works as intended -> Option C
Quick Check:
Base then md: override works [OK]
Hint: Base class first, then md: override for bigger screens [OK]
Common Mistakes:
Thinking order of classes matters in Tailwind
Believing md: prefix must be on base class
Assuming Tailwind can't override colors
5. You want a button that is full width on small screens but only 200px wide on medium and larger screens using Tailwind. Which class combination achieves this?
hard
A. w-full w-[200px] md:w-full
B. md:w-full w-[200px]
C. w-[200px] md:w-full
D. w-full md:w-[200px]
Solution
Step 1: Understand mobile-first width classes
Use w-full for full width on small screens (default). Use md:w-[200px] to set width 200px on medium+ screens.
Step 2: Check options for correct order and values
w-full md:w-[200px] sets full width by default, then overrides to 200px on medium screens. Others reverse or duplicate incorrectly.
Final Answer:
w-full md:w-[200px] -> Option D
Quick Check:
Default full width, md override 200px [OK]
Hint: Default small screen first, then md: for bigger screens [OK]
Common Mistakes:
Reversing order of width classes
Using md: on full width instead of fixed width
Duplicating conflicting width classes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.