Export (0) Print
Expand All

Positioned elements

The measurements of an element with absolute positioning are defined first by any specified measurement properties, such as height or width, and then by its content. This is true for block and inline elements. However, a relatively positioned element retains its block or inline measurements unless otherwise specified.

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: 30px;">
   Text
</span>

You can use the same procedure to set or retrieve the measurements of positioned elements and non-positioned elements.

Community Additions

ADD
Show:
© 2015 Microsoft