Challenge - 5 Problems
Sidebar Layout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ layout
intermediate2:00remaining
What is the visual layout of this Tailwind sidebar and main content code?
Given the following Tailwind CSS code, what will the user see in the browser?
Tailwind
<div class="flex h-screen"> <aside class="w-64 bg-gray-800 text-white p-4">Sidebar</aside> <main class="flex-1 p-6">Main Content</main> </div>
Attempts:
2 left
💡 Hint
Think about how the flex container arranges its children by default.
✗ Incorrect
The 'flex' class creates a horizontal layout by default. The sidebar has a fixed width of 16rem (w-64), and the main content uses flex-1 to fill the remaining space. So the sidebar appears on the left and main content on the right.
❓ accessibility
intermediate1:30remaining
Which ARIA role should be added to the sidebar for better accessibility?
You have a sidebar navigation area in your layout. Which ARIA role is best to add to the
Tailwind
<aside class="w-64 bg-gray-800 text-white p-4">Sidebar</aside>Attempts:
2 left
💡 Hint
Think about what the sidebar usually contains.
✗ Incorrect
Sidebars often contain navigation links, so using role="navigation" helps assistive technologies identify it as a navigation landmark.
❓ selector
advanced2:30remaining
Which Tailwind class combination correctly makes the sidebar fixed and scrollable independently?
You want the sidebar to stay fixed on the left side and be scrollable if content overflows, while the main content scrolls separately. Which option achieves this?
Attempts:
2 left
💡 Hint
Fixed position keeps the sidebar visible while scrolling the main content.
✗ Incorrect
Using 'fixed' with 'top-0 left-0 h-full w-64' pins the sidebar to the left full height. 'overflow-y-auto' allows vertical scrolling inside the sidebar if needed. The main content is pushed right with 'ml-64'.
📝 Syntax
advanced2:00remaining
What error occurs with this Tailwind layout code?
Consider this HTML snippet using Tailwind classes. What error or problem will happen when rendered?
Tailwind
<div class="flex"> <aside class="w-64 bg-gray-800 text-white p-4">Sidebar</aside> <main class="w-full p-6">Main Content</main> </div>
Attempts:
2 left
💡 Hint
Think about how width classes behave inside a flex container.
✗ Incorrect
In a flex container, 'w-full' on main tries to take 100% width of the container, ignoring the sidebar's width, causing horizontal overflow and a scrollbar.
🧠 Conceptual
expert3:00remaining
How does using CSS Grid improve sidebar and main content layout over Flexbox in Tailwind?
Which statement best explains the advantage of using CSS Grid for a sidebar and main content layout compared to Flexbox?
Attempts:
2 left
💡 Hint
Think about layout directions and control over rows and columns.
✗ Incorrect
CSS Grid is designed for two-dimensional layouts, letting you control rows and columns explicitly. Flexbox is one-dimensional, either row or column, so complex grid-like layouts are easier with CSS Grid.