HTML and CSS Reference
elements such as toolbars or banners and not for laying out an overall
Fixed-positioned elements are widely supported in current browsers,
but if you find you need to support older browsers as well, then you
monitor the use of the scrollbar to change the positioning of the element to
keep it in view. This solution can be a little jumpy, so it's best to use position:
fixed where it is supported.
Containing blocks and the behavior of managing multiple possible
origins for measuring positioning from can be one of the more confusing,
but also more powerful, aspects of CSS.
The root element of the document is the initial containing block for
which absolute positioning is measured from. However, if any other
element is positioned—relatively, absolutely, or fixed in the viewport—
it becomes the new origin for its descendant elements. This behavior is
probably best illustrated with an example ( Figure 6.3 ).
Figure 6.3 The position of the black #innerPositionedBox
is measured from its containing block.