liveBook · Manning

Viewport

A viewport is the visible region of a browser or graphical interface in which a document or other content is displayed.

How 3 Manning books explain it

Math for Web Design

The viewport is the visible area of a browser window in which a web page is rendered.

How it is used
Uses the visible browser area as a reference for responsive sizing, element measurements, and pointer positions.
How deep it goes
Defines the coordinate origin and units, works through sizing and DOM measurements, and distinguishes mobile toolbar-dependent viewport heights.
Examples
Demonstrates a full-screen hero, clamped margin, mobile overflow fix, and cursor-following tooltip.
What you can do after
Apply it via CSS viewport units and JavaScript DOM APIs to size layouts and position interface elements.

Read how Math for Web Design explains viewport →

CSS in Depth, Second Edition

A viewport is the framed area of a browser window in which a web page is visible, excluding browser interface controls.

How it is used
Defines responsive lengths for viewport-filling heroes, mastheads, and orientation-resistant elements.
How deep it goes
Defines original and newer viewport units, explains orientation behavior and trade-offs, and notes scrollbar and keyboard caveats.
Examples
Uses a 90vmin square, a full-height hero image, and lvh-versus-svh masthead sizing.
What you can do after
Apply viewport-relative units to size responsive elements and choose large or small viewport behavior for mastheads.

Read how CSS in Depth, Second Edition explains viewport →

Tiny CSS Projects

A browser viewport is the visible rectangular area through which a web page is rendered.

How it is used
Frames responsive SVG graphics inside a loading screen.
How deep it goes
Defines frame sizing and overflow, then distinguishes viewport dimensions from viewBox positioning and scaling.
Examples
Uses a scanning loader, a 100-percent-wide SVG, a 300-pixel frame, and a 710-by-300 viewBox.
What you can do after
Apply via SVG width and height attributes to create a responsive frame for contained graphics.

Read how Tiny CSS Projects explains viewport →

Also covered in

What to know first

Related concepts

Questions about viewport

What is viewport?

A viewport is the visible region of a browser or graphical interface in which a document or other content is displayed.

Which Manning books explain viewport?

Math for Web Design, CSS in Depth, Second Edition and Tiny CSS Projects.

What should I know before learning viewport?

Manning books that teach viewport usually introduce block-level element first.

What is viewport a kind of?

Viewport is a kind of 2d coordinate system. A coordinate system that represents positions in a two-dimensional space using two perpendicular axes.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.