Home / Learn HTML / HTML Responsive Web Design
HTML Responsive Web Design
Make one page look good on phones, tablets and big screens.
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.
- Always add
<meta name="viewport" content="width=device-width, initial-scale=1">. - Make images flexible with
max-width:100%; height:auto. - Design for the small screen first, then widen (mobile first).
Theory in plain words
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
Use full screen and drag the window narrower.
Quick quiz
1. Which tag makes pages mobile friendly?
Viewport matches device width.
2. max-width:100% on an image makes it
It shrinks with the screen.
3. Media queries start with
@media (max-width:500px){...}.