Name

backgroundPosition — NN n/a IE 4 DOM n/a

Synopsis

Read/Write

Top and left location of the background image relative to the element’s content region (plus padding). This property is not properly connected in Internet Explorer 4 for the Macintosh.

Example

document.all.div3.style.backgroundPosition = "20 50"

Value

You should be able to specify one or two percentages, which are the percentages of the block-level element’s box width and height (respectively) at which point the image (or repeated images) begins. Setting percentage values, however, does not always work in IE 4 for Windows (and it doesn’t work at all on the Mac), even though they are returned as the default value units. You are safest with pixel values (as space-delimited values inside one string). None of the allowed constants except top and left are recognized.

Default

0% 0%

Get Dynamic HTML: The Definitive Reference 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.