Sets or retrieves the position of the background of the object.
HRESULT IHTMLRuleStyle::get_backgroundPosition(BSTR *p);HRESULT IHTMLRuleStyle::put_backgroundPosition(BSTR v);
- Pointer to a variable of type BSTR that receives one or two of the values listed in Possible Values.
- BSTR that specifies one or two of the values listed in Possible Values.
length Floating-point number, followed by an absolute units designator (
pc) or a relative units designator (
px). For more information about the supported length units, see CSS Length Units Reference.
percentage Integer, followed by a percent sign (%). The value is a percentage of the width or height of the object. vAlignment Vertical alignment value. Possible values include the following:topVertical alignment is at the top.centerVertical alignment is centered.bottomVertical alignment is at the bottom. hAlignment Horizontal alignment value. Possible values include the following:leftHorizontal alignment is to the left.centerHorizontal alignment is centered.rightHorizontal alignment is to the right.
Returns S_OK if successful, or an error value otherwise.
If only one value is set, that value applies to the horizontal coordinate, and the vertical is set to
50%. If both values are set, the first value applies to the horizontal coordinate and the second value applies to the vertical.
Setting the values to
0% 0%(initial value) positions the IHTMLRuleStyle::backgroundImage to the upper left corner of the element's content block, which includes the padding.
Setting the background position using pixels positions the upper-left of the image at the specified x and y coordinates within the parent element. As the coordinates increase, the image moves to the right and down the visible area. By contrast, setting the background position with percentages uses a corresponding point on the image. At a position of
50% 50%the image is effectively centered within the visible area.
This property can be set with the other background properties using the IHTMLRuleStyle::background composite property.