Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewport vs canvas in the w3c specification?

I am reading a w3c specification and trying to understand the difference between the canvas and the viewport.

They say:

The canvas is the space where the formatting structure is rendered.

And at the same time they say:

Viewport is a window or other viewing area on the screen

These two definitions don't clarify what is the canvas and what is the viewport. Can anyone give a clear or explanatory definition of those?

like image 390
Hommer Smith Avatar asked Oct 27 '25 10:10

Hommer Smith


1 Answers

The viewport is the visible box between the inner borders of your browser;
The canvas is the box containing the whole document. A part of the canvas may be invisible if it does not fit in the viewport.

In other words:

  • The viewport is the allocated area on the screen for displaying the web page. This box is of a fixed size, and can only be changed when the user resizes the window.
  • The canvas can be bigger than the viewport. In this case, scrollbars may appear.
like image 191
Rob W Avatar answered Oct 28 '25 23:10

Rob W



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!