HTML & CSS
/Intermediate
Grid vs Flexbox
Definition
Understanding when to use CSS Grid (2-Dimensional) versus Flexbox (1-Dimensional).
Explain Like I'm New
Use Flexbox when you have a row of items (like a navbar) and you just want to space them out evenly without caring about exact widths. Use Grid when you want to explicitly define the entire layout of the page (Sidebar here, Header there) and lock elements into a rigid structure.
Real World Example
They are meant to be used together! You use CSS Grid on the `<body>` to set up the Header, Sidebar, and Main content areas. Inside the Header, you use Flexbox to align the Logo and the Profile Avatar.
Common Use Cases
- •Architecting web applications
Interactive Example
Interview Questions
basic
- Which one is 1-Dimensional and which is 2-Dimensional?
intermediate
- If I want a row of tags (`#html`, `#css`) to automatically wrap to the next line when they run out of space, which should I use?