background-position

The background-position property specifies the background image's initial position.

Values

background-position: value
Value Initial Description
bottom Computes to 100% for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.
center Computes to 50% (left 50%) for the horizontal position if the horizontal position is not otherwise specified, or 50% (top 50%) for the vertical position if it is.
left Computes to 0% for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset.
length A length value gives a fixed length as the offset.
percentage 0% 0% A percentage for the horizontal offset is relative to (width of background positioning area - width of background image). A percentage for the vertical offset is relative to (height of background positioning area - height of background image), where the size of the image is the size given by background-size.
right Computes to 100% for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset.
top Computes to 0% for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset.

DOM

object.style.backgroundPosition = "value";

Example | bottom

Example | center

Example | left

Example | length

Example | percentage

Example | right

Example | top

Example | DOM

External

W3C Cascading Style Sheets, level 1

W3C Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification

W3C CSS Backgrounds and Borders Module Level 3