Logo Image
blog

Mastering Grid for Modern Web Design

HTML5 & CSS3

icon-image

SCSS

icon-image

JavaScript

icon-image

TypeScript

icon-image

React

icon-image

Next.js

icon-image

Tailwind CSS

icon-image

Bootstrap

icon-image

ShadCN UI

icon-image

Styled Components

icon-image

GSAP

icon-image

Framer Motion

icon-image

Vite

icon-image

Shopify themes

icon-image

i18next & RTL

icon-image

Recharts

icon-image

Chart.js

icon-image

SaaS dashboards

icon-image

Figma to UI

icon-image

Dark / light mode

icon-image

4+ years

icon-image

Vistothemes

icon-image

Freelance UI

icon-image

NFT & crypto UI

icon-image

eCommerce UI

icon-image

WordPress CSS

icon-image

Remote-ready

icon-image

Muhammad Shahzaib

icon-image

Pixel-perfect

icon-image

Component architecture

icon-image

Live demos

icon-image

HTML5 & CSS3

icon-image

SCSS

icon-image

JavaScript

icon-image

TypeScript

icon-image

React

icon-image

Next.js

icon-image

Tailwind CSS

icon-image

Bootstrap

icon-image

ShadCN UI

icon-image

Styled Components

icon-image

GSAP

icon-image

Framer Motion

icon-image

Vite

icon-image

Shopify themes

icon-image

i18next & RTL

icon-image

Recharts

icon-image

Chart.js

icon-image

SaaS dashboards

icon-image

Figma to UI

icon-image

Dark / light mode

icon-image

4+ years

icon-image

Vistothemes

icon-image

Freelance UI

icon-image

NFT & crypto UI

icon-image

eCommerce UI

icon-image

WordPress CSS

icon-image

Remote-ready

icon-image

Muhammad Shahzaib

icon-image

Pixel-perfect

icon-image

Component architecture

icon-image

Live demos

icon-image
home

/

blog

2026-09-175 min read
Mastering Grid for Modern Web Design

CSS Grid is the right tool once a layout needs both rows and columns to line up together — page shells, dashboards, image galleries, pricing tables. The part that trips people up coming from Flexbox is that Grid defines the structure on the parent up front, rather than letting children negotiate space.

Defining the grid

grid-template-columns sets up the column tracks. 1fr 1fr 1fr gives three equal columns; 200px 1fr gives a fixed sidebar next to a fluid content area. gap replaces the old margin-hack spacing between grid items.

The auto-fit + minmax trick

This is the one pattern that removes most manual breakpoints: grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)). The browser fits as many 240px-minimum columns as will fit the row, and stretches them to fill the remaining space — a responsive card grid with zero media queries.

Placing items explicitly

grid-column and grid-row (or named grid-template-areas) let a specific item span multiple tracks — useful for a featured card that should take up two columns while the rest stay single-width.

responsive-grid.css
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.gallery .featured {
  grid-column: span 2;
}

Grid and Flexbox aren't competitors — most real interfaces use Grid for the page shell and Flexbox inside individual components like cards and nav bars.

← back to all writing

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

arrow-image

Start a project — tell me what you’re building and your timeline.

logo-image

I’m Muhammad Shahzaib—a frontend developer with 4+ years at Vistothemes and on freelance SaaS projects (Deedible, Next Health, Truckers Finder). I build pixel-perfect UI with React, Next.js, TypeScript, Tailwind, ShadCN, and Shopify—plus HTML/CSS templates, RTL bilingual layouts, and dashboard work with Recharts and Chart.js. UI only; no backend or APIs.

Muhammad Shahzaib Copyright © 2026. All Rights Reserved.