Skip to main content
InterviewHubPRO
Section Overview
Q9

Question 9 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

18%
CSS3 & Modern Layouts (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What is CSS Grid and when should you choose Grid vs. Flexbox?

junior LevelCode ExamplecssBasic

In Simple Words:

  • Flexbox: One-Dimensional (Row OR Column). Best for aligning items in a line (navbars, toolbars, card header metadata, button groups). Content-driven (elements determine size).
  • CSS Grid: Two-Dimensional (Rows AND Columns simultaneously). Best for macro page layouts, photo galleries, dashboard widget layouts, and responsive cards where items must align both vertically and horizontally.
css
/* Responsive Grid with NO media queries! */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}