Home / Learn HTML / HTML Responsive Web Design

HTML Responsive Web Design

Make one page look good on phones, tablets and big screens.

In shortAdd the viewport tag, use flexible widths (%, max-width) and media queries. Open an example in full screen and resize the window.

Definition

Responsive design means a page adapts to every screen size, from a phone to a wide monitor. It rests on three things: the viewport meta tag, flexible widths (percent, max-width) and media queries that change the layout at set widths.

Theory in plain words

Same HTML, three layoutsPhone1 columnTablet2 columnsDesktop3 columns
Same HTML, three layouts

What it is

Responsive design makes a page fit any screen size, from phone to wide monitor.

Why we use it

More than half of visits come from phones. A page that does not fit loses visitors and ranking.

How it works

The viewport meta tag sets the width, flexible units and media queries change the layout, and srcset serves the right image.

Where it is used

  • Every modern site
  • Mobile first design
  • Responsive images
Viewport tagTry it Yourself
Flexible imageTry it Yourself
Percentage widthTry it Yourself
max-width for readable textTry it Yourself
Media queryTry it Yourself

Use full screen and drag the window narrower.

Flexible columns that wrapTry it Yourself
Responsive grid without media queriesTry it Yourself
Hide on small screensTry it Yourself
Responsive font sizeTry it Yourself
picture with srcsetTry it Yourself
Responsive videoTry it Yourself
Responsive tableTry it Yourself
Responsive menuTry it Yourself

Quick quiz

1. Which tag makes pages mobile friendly?

2. max-width:100% on an image makes it

3. Media queries start with

My notes
Ask a question about this lesson