-
The
background-positionCSS property sets the initial position for each background image. -
The position is relative to
the position layer set by
background-origin - A position defines an x/y coordinate, to place an item relative to the edges of an element's box.
- It can be defined using one to four values
-
If two non-keyword values are used, the first value represents the
horizontalposition and the second represents theverticalposition -
If only one value is specified, the second value is assumed to be
center - If three or four values are used, the length-percentage values are offsets for the preceding keyword value(s)
-
If two non-keyword values are used, the first value represents the
-
1-value syntax- The keyword value center, which centers the image
-
One of the keyword values
topleftbottomright
-
A
lengthorpercentage. This specifies theX coordinaterelative to the left edge, with theY coordinate set to 50%
-
2-value syntax
One value defines X and the other defines Y. Each value may be:- One of the keyword values
topleftbottomright
-
If
leftorrightis given, then this definesXand the other given value definesY -
If
toporbottomis given, then this definesYand the other value definesX - Note that:
-
If one value is
toporbottom, then the other value may not betoporbottom - If one value is left or right, then the other value may not be left or right
-
If one value is
- One of the keyword values
3-value syntax
Two values are keyword values, and the third is the offset for the preceding value-
4-value syntax- The first and third values are keyword values defining X and Y
- The second and fourth values are offsets for the preceding X and Y keyword values