viewport

The visible area of a web page in the browser window or device screen.

In more detail

The vw unit is 1% of the viewport width, so 50vw is half the window's width. Floating elements must stay inside the viewport, and visual tests lock the viewport size so screenshots are comparable.

Examples

In the browser: Layout positions are often relative to the viewport, and media queries test its width. Container queries instead test the size of a component's own container.
A virtualised list renders only the items that fit in its viewport: viewport height divided by row height gives the number of rows.

Related terms

Taught in

References