Viewport Units

Learn about the CSS units related to the viewport.

What is a viewport?

The viewport is the visible area of a web page. It changes depending on the user’s device. It’s usually much smaller on mobile devices.

Before smartphones and tablets, web pages were only designed for computer screens, and it was common for them to have a fixed size.

Now, we often use smartphones and tablets to browse the internet, so fixed-size web pages are far too large to fit on these smaller screens. Flexible layouts are the solution to this!

CSS viewport units are a great way to get started with flexible layouts, which we’ll look at in detail in this lesson.

Viewport units

The

...