Partager via


textBackgroundColor property

Sets or retrieves the color behind the text in the object.

Syntax

HRESULT value = object.put_textBackgroundColor(VARIANT v);HRESULT value = object.get_textBackgroundColor(VARIANT* p);

Property values

Type: VARIANT

One of the values in the Property Values section.

Remarks

There is only a difference between the transparent and undefined values when there are multiple style properties that apply to a single run of text. In this situation, the IHTMLRenderStyle::renderingPriority property determines which colors are applied. An undefined value does not participate in background color determination, regardless of its priority. A transparent value only has an effect if it has the highest priority value—that is, if it is the text background color value that is ultimately applied to the given text run.

For instance, consider a style1, with priority 1, which specifies red. Then consider a style2, with priority 2, which specifies undefined. If both styles are applied to the same run of text, red is ultimately used as the background color because style2, even though it has a higher priority, is undefined and therefore has no effect.

Now consider a style3, with priority 2, which specifies transparent. If both style1 (defined in the previous paragraph) and style3 are applied to the same run of text, no additional background color is applied because style3 has a higher priority, so transparent is applied instead of red. Of course, if color was applied via CSS, that color will appear.