liveBook · Manning

Viewport

A viewport is the visible region through which a browser or graphical interface displays a document or content.

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
Anchors responsive sizing, DOM measurement, pointer interaction, and breakpoint decisions to the visible browser area.
How deep it goes
Defines axes and units, then works through CSS sizing, dynamic mobile heights, DOM rectangles, and pointer-coordinate conversions.
Examples
Uses a full-screen hero, viewport-scaled headings, a cursor-following tooltip, responsive margins, and mobile full-screen overflow fixes.
What you can do after
Apply it via CSS viewport units and browser coordinates to size, measure, and position responsive 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 →

Related concepts

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.