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.

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.