โ FAQ โ CSS Grid Generator
What is CSS Grid?
CSS Grid Layout is a two-dimensional layout system โ it handles both rows and columns simultaneously. Unlike Flexbox (which is one-directional), Grid lets you place items in specific row and column positions, create named areas, and build complex responsive layouts with clean, minimal CSS. Grid is ideal for full-page layouts, dashboards, card galleries, and any design that needs both horizontal and vertical control.
What does the fr unit mean in CSS Grid?
The fr (fraction) unit represents a fraction of the available space in the grid container. For example, grid-template-columns: 1fr 2fr creates two columns where the second is twice as wide as the first. 1fr 1fr 1fr creates three equal columns (equivalent to 33.33% each, but more flexible). The fr unit distributes space after fixed-size tracks (px, %, auto) are accounted for, making it ideal for fluid, responsive layouts.
When should I use Grid vs Flexbox?
Use Flexbox for one-dimensional layouts โ aligning a row of navigation links, a row of cards, or any layout that flows in one direction. Use Grid for two-dimensional layouts โ full page structure with header/sidebar/content/footer, image galleries, dashboards, or any design where you need to control both rows and columns at once. In practice, you often use both: Grid for the page layout, Flexbox for the content within each grid area.