HTML and CSS Reference
In-Depth Information
elements such as toolbars or banners and not for laying out an overall
web page.
Fixed-positioned elements are widely supported in current browsers,
but if you find you need to support older browsers as well, then you
should use a bit of JavaScript code that will position the element absolutely and
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.
Origins and Containing Blocks
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.
Search WWH ::

Custom Search