▦
Websites

CSS Grid: a modern approach to 2D web layouts

08.04.2025
← All articles

CSS Grid is a 2D layout technology. Flexbox is 1D, Grid is 2D. Since 2017 it has changed web design.

Basics

display: grid. grid-template-columns: 1fr 1fr 1fr.

Lines and tracks

Tracks — rows and columns. Lines — borders.

grid-template-columns/rows

200px 1fr 100px — fixed and flexible.

fr unit

fr is a fraction of the remaining space.

repeat

repeat(4, 1fr) — 4 equal columns.

auto-fill/auto-fit

repeat(auto-fill, minmax(200px, 1fr)) — responsive.

grid-column/row

grid-column: 1 / 3 — span 2 columns.

span

span 2 — 2 cells wide.

grid-template-areas

Named areas, visual layout. \"header header\", \"sidebar main\", \"footer footer\".

Mobile responsive

Media queries. grid-template-areas changes.

Product grid example

repeat(auto-fill, minmax(250px, 1fr)) + gap.

Flexbox vs Grid

Flexbox 1D, Grid 2D. Often used together.

Support

All modern browsers.

Sayt.uz

Main layout uses Grid template-areas. Blog listing uses an auto-fill grid.

Related articles

🧾 Online Shops and Fiscal Receipts: Virtual Cash Register Requirements 💻 IT Company Website: Strategy for Software Houses, Outsourcing, and Developer Services 🌾 Agriculture and Agribusiness Website: Product Catalog and B2B Sales 🧪 Medical Laboratory Website: Test Catalog, Online Booking, and Results Delivery
🌐 Language
🇺🇿 O⁠'zbek 🇺🇿 Özbek (yangi) 🇺🇿 Ўзбек 🇷🇺 Русский 🇬🇧 English ✓