Skip to content
UPEEC

CSS Layout and Responsive Design

Flexbox, Grid and the tools that make pages work on every screen size.

Easy
Comments 0

This is an overview — pick a sub-topic below.

Sub-topics (16)

Flexbox

One-dimensional layout along a row or column with flexible sizing and alignment.

Easy♥ 0🔖 0💬 0

CSS Grid

Two-dimensional layout with rows and columns.

Easy♥ 0🔖 0💬 0

Multi-Column Layout

Flow text into newspaper-style columns: `columns: 3 18rem;`.

Easy♥ 0🔖 0💬 0

Normal Flow

The default layout: block boxes stack vertically, inline content flows in lines.

Beginner♥ 0🔖 0💬 0

Float

Push an element left or right so text wraps around it.

Easy♥ 0🔖 0💬 0

Clear

Stop elements from wrapping beside earlier floats: `clear: both`.

Easy♥ 0🔖 0💬 0

Media Queries

Apply styles based on viewport size, orientation, colour scheme or input type.

Easy♥ 0🔖 0💬 0

Container Queries

Style a component based on its container's size rather than the viewport.

Intermediate♥ 0🔖 0💬 0

Responsive Design

One site that adapts to phones, tablets and desktops.

Easy♥ 0🔖 0💬 0

Fluid Typography

Font sizes that scale smoothly with viewport width.

Intermediate♥ 0🔖 0💬 0

Viewport Units

`vw`, `vh` and the newer `svh`/`lvh`/`dvh` (small/large/dynamic viewport) units.

Easy♥ 0🔖 0💬 0

Aspect Ratio

`aspect-ratio: 16 / 9;` keeps a box's proportions as it resizes.

Easy♥ 0🔖 0💬 0

object-fit

How an image or video fills its box: `cover` (crop), `contain` (letterbox), `fill`, `none`.

Easy♥ 0🔖 0💬 0

Logical Properties

Direction-aware properties: `margin-inline`, `padding-block`, `inset-inline-start`, `inline-size`.

Intermediate♥ 0🔖 0💬 0

Writing Modes

Horizontal or vertical text flow: `writing-mode: vertical-rl;`.

Intermediate♥ 0🔖 0💬 0

Sticky Positioning

`position: sticky; top: 0;` keeps an element in view while scrolling within its container.

Easy♥ 0🔖 0💬 0

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.