Positioned elements in strict mode

The measurements of an element with absolute or fixed positioning are defined only by a specified height or width. This is not true for block or inline elements, for which the size of the content plays a more active role in their dimensions. A relatively positioned element will retain its block or inline measurements, unless otherwise specified.

In earlier versions than Windows Internet Explorer 7, Internet Explorer automatically resized elements to accommodate content, regardless of the assigned dimensions. The Internet Explorer 7 strict mode accepts specified height and width properties. Given the implications of this change, it is important to consider content overflow. If left undefined, excess content may spill out of its content box.

For more information about regulating overflowing data, see overflow.

The following example shows that the measurements of a block element and an inline element are the same when the position property is set to absolute:

<div style="background-color: #CFCFCF; position: relative; top: 10px;">
   Text
</div>
<span style="background-color: #CFCFCF; position: absolute; top: 0px;">
   Text
</span>

See also

Concepts

position
Properties by name
Cascading style sheet reference
Measurement and location properties in quirks mode

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.