Revision Content

{{ CSSRef() }}

Summary

The <position>CSS data type denotes a coordinate in a 2D space used to set a location relative to a box.

A specific coordinate can be given by a two keywords, with specific offsets. A keyword represent one edge of the element's box or the medium line between two edges: left, right, top, bottom or center (which represents either the center between the left and right edges, or the center between the top or bottom edges, depending on the context).

{{ experimental_inline() }}An offset can be either a relative value, expressed as a {{ xref_csspercentage() }}, or an absolute {{ xref_csslength() }} value. Positive values are offset towards the right or towards the bottom, whichever is suitable. Negative values are offset in the other directions.

The final position described by the <position> value does not need to be inside the element's box.

If an offset is given without an associated keywords, this one is assumed to be center.

Interpolation

Both the abscisses and ordinate values are interpolated independantly. As the speed is defined by the same {{ xref_csstimingfunction() }} for both, the point will move following a line.

/* 1-value syntax */
keyword /* The corresponding edge, the other direction is corresponding to center, the middle of the edge */
<length> or <percentage> /* The position on the x-axis, 50% for the y-axis */
/* 2-value syntax */
keywordkeyword /* A keyword for each direction, the order is irrelevant */
keyword value/* The value is the offset for the edge defined by the keyword */
/* 2-value syntax with fixed offset */

Specification

Specification

Status

Comment

{{ SpecName('CSS3 Values', '#position', '<position>') }}

{{ Spec2('CSS3 Values') }}

Relists links to both definition, with the requirement to be coherent: if {{ SpecName('CSS3 Backgrounds', '', '') }} is supported, its definition of <position> must be used too.

{{ SpecName('CSS3 Backgrounds', '#ltpositiongt', '<position>') }}

{{ Spec2('CSS3 Backgrounds') }}

Defines <position> explicitly and extends it to support offsets from any edge. {{ experimental_inline() }}