The Browser Viewport

The browser viewport is the window in the browser through which the document content is viewed. This is a fairly simple concept, but, again, it's a distinct one from containing blocks.

In positioning, in some cases, element boxes are positioned in relation to the viewport and not normal flow or containing blocks. So understanding the viewport is important (see Figure 12-4).

Figure 12-4. The Firefox browser with sidebar, menus, and status barthe viewport is only the window through which you're seeing the document.


It is considered conventional browser behavior to include a scrollbar in the viewport when the content is longer or wider than the available viewport space. Browsers behave differently in this regard, partly because the guidelines are not very specific when it comes to how browsers should ideally behave. As a result, there will be inconsistencies in the way users experience your designs, no matter what techniques you use.