Responsive design

Knowledge Videos

Short animated explainers, organised by subject.

Responsive design

Make a page fit any screen: the viewport meta tag, flexible sizes with percentages and max-width, and a media query that stacks the cards on narrow screens.

Transcript

People look at web pages on big screens, laptops, tablets and phones. A responsive page changes its layout to fit the screen it is on.

First, add the viewport meta tag to the head. It tells a phone to use its real width. Without it, a phone shows a tiny, zoomed out copy of the desktop page.

Next, use flexible sizes, like percentages, and max width. Then boxes can shrink with the window instead of sticking out.

Finally, a media query applies rules only when a condition is true. When the screen is narrower than six hundred pixels, the cards stack in one column instead of a row.

Remember: a responsive page adapts to the screen. Use the viewport tag, flexible sizes, and media queries.

More in this series