Gets or sets up to five separate background properties of the object.
HRESULT IHTMLCSSStyleDeclaration::get_background(BSTR *p);HRESULT IHTMLCSSStyleDeclaration::put_background(BSTR v);
- Pointer to a variable of type BSTR that receives up to five of the space-delimited Possible Values, in any order.
- BSTR that specifies up to five of the space-delimited Possible Values, in any order.
color Any of the range of color values available to the IHTMLStyle::backgroundColor property. image Any of the range of image values available to the IHTMLStyle::backgroundImage property. repeat Any of the range of repeat values available to the IHTMLStyle::backgroundRepeat property. attachment Any of the range of attachment values available to the IHTMLStyle::backgroundAttachment property. position Any of the range of position values available to the IHTMLStyle::backgroundPosition property.
Returns S_OK if successful, or an error value otherwise.
The IHTMLCSSStyleDeclaration::background property is a composite property. Separate properties can be used to specify each property, but in many cases it is more convenient to set them in one place using this composite property.
Individual background properties not set by the composite background property are set to their default values. For example, the default value for image is
none. Setting IHTMLCSSStyleDeclaration::background:
whiteis equivalent to setting IHTMLCSSStyleDeclaration::background:
0%. So, in addition to setting the background color to white, setting IHTMLCSSStyleDeclaration::background:
whiteclears any image, repeat, attachment, or position values previously set.
The background properties render in the object's content and padding; however, borders are set using the IHTMLStyle::border properties.
In Microsoft Internet Explorer 3.0, elements that expose the IHTMLCSSStyleDeclaration::background property only support the color and image values; the attachment value is only supported by the body, table, and td elements. In block elements, such as p and div, background images and colors appear only behind text in Internet Explorer 3.0; in Internet Explorer 4.0 and later, backgrounds stretch from margin to margin when used with block elements.
Although objects do not inherit the IHTMLCSSStyleDeclaration::background property, the background image or color of an object's parent appears behind an object if a background is not specified.
For more information about supported colors, see the Color Table.