javascript STYLE backgroundPosition
backgroundPosition | Firefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 2 | |||||||||||||||||||||||||||||||||||||||||||||||
|
Read/Write | |||||||||||||||||||||||||||||||||||||||||||||||
Indicates the top and left location of a background image relative to the element's content region (plus padding). Positions may be specified as length values (with numbers and units or percentages) or according to a combination of constants top, right, bottom, left, and center. The property has no effect on a background images set to repeat along both axes. Some value types don't work (or work correctly) in IE 4. Available as a property of the IE style and runtimeStyle objects only. |
||||||||||||||||||||||||||||||||||||||||||||||||
Example | ||||||||||||||||||||||||||||||||||||||||||||||||
document.getElementById("div3").style.backgroundPosition = "20% 50%"; |
||||||||||||||||||||||||||||||||||||||||||||||||
Value | ||||||||||||||||||||||||||||||||||||||||||||||||
A string containing one value (to be applied to both horizontal and vertical axes) or a space-delimited pair of values. Values may be explicit length values (with units, as in 30px 5px), percentages (e.g., 50% 50%) or position constants that have explicit meanings for their combinations. |
||||||||||||||||||||||||||||||||||||||||||||||||
Percentage values are interpolated logically. For example, a value of 0% means that the image abuts the left or top edge of the element block; a value of 50% centers the image vertically or horizontally; a value of 100% places the image flush right or bottom.. |
||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
Default | ||||||||||||||||||||||||||||||||||||||||||||||||
0% 0% |
Powered by Linode.