Name
background-position
Values:
percentage|length|top/center/bottom|left/center/right
Example:
BODY { background-image: url (oldmap.gif); background-position: bottom left }
BODY { background-image: url (oldmap.gif); background-position: 100% 0% }
Applies to:
Block-level elements and replaced elements
Inherited:
No
When a background image has been specified, this property specifies its initial position relative to the box that surrounds the content of the element (not including its padding, border, or margin).
The CSS methods for specifying position get a bit complicated. Values are given in horizontal/vertical pairs, with a default value of 0%/0%, which places the upper-left corner of the image in the upper-left corner of the element. A value of 100%/100% would place the image in the bottom-right corner of the element.
Length values from the left and top margin can also be specified. Or you can use the keywords, which correspond to the percentage values 0%, 50%, and 100%, respectively. The two examples given create the same result, with the bottom-left corner of the image placed in the bottom-left corner of the element.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access