Positioning Elements

In CSS2, the position property enables you to position elements on the page. It takes the following values: static, absolute, relative, and fixed. The static value corresponds to the normal flow and is the default. The absolute value positions an element relative to the containing block. The relative value positions an element relative to its current position. The fixed value “fixes” an element's position relative to the browser window, so that it remains fixed when the page is scrolled. The fixed value is currently only supported by Opera 5 (with some bugs).

Using Absolute Positioning

The position: absolute property specifies that an element is to be positioned relative to the containing block. If the element is nested inside ...

Get Cascading Style Sheets (CSS) by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.