Viewport
Definition
The viewport is the area in which a browser currently displays the visible content of a webpage.
A viewport is the visible section of a document in the browser. The layout viewport serves as the basis for page layout; the visual viewport describes the actually visible area, for example when zooming. Neither is equivalent to the entire screen size.
Simply explained
You look through a window onto a longer page. Scrolling shifts the section; zooming changes how much you see at once.
Why it matters in practice
Responsive design must consider the space actually available for content instead of relying solely on device sizes.
Example from business
Possible example: When opening the on-screen keyboard, less visible space remains on a smartphone for an input form and its button.
Limits and pitfalls
- Viewport, screen resolution, and browser window are not identical. The viewport meta element influences the display but is not the viewport itself.
Origin & history
The viewport concept describes the visible document section. Mobile browsers and zooming made the distinction between layout and visual viewport particularly relevant.
Use in mid-sized companies
- Businesses can test forms and navigation on small views, zoom, and with the on-screen keyboard displayed to ensure important functions remain accessible.
Frequently asked questions
Does a page have only one viewport?
For many tasks, the simplified view is sufficient. However, mobile zooming requires distinguishing between layout and visual viewport.
Sources
- 2025, Viewport · MDN Web Docs, 2025, Viewport
Editorially reviewed on: