Cascading Style Sheets: Designing for the Web (3rd Edition)

The position property determines whether elements are "normal" elements, or whether they are subject to relative, absolute, or fixed positioning.

Name:

position

Value:

static | relative | absolute | fixed

Initial:

static

Applies to:

all elements

Inherited:

no

Percentages:

N/A

Elements that don't use any positioning methods are called static. This is the normal case. The values absolute and fixed imply that the element must be a block. The value of the display property is ignored in this case. Elements that are not static make use of the four positioning properties: top, right, bottom, and left.

Name:

top, right, bottom, left

Value:

<length> | <percentage> | auto

Initial:

auto

Applies to:

elements with position other than static

Inherited:

no

Percentages:

width or height of "containing block"

These properties determine the position of a positioned element by setting the distance from the edge of a so-called containing block, which is explained in the next section. The meaning changes slightly with the type of positioning and will be explained in following sections.

Категории