Share via


currentStyle property

Gets a reference to the currentStyle object, which represents the current cascaded format and style specified by global style sheets, inline styles, and HTML attributes.

Syntax

HRESULT value = object.get_currentStyle(IHTMLCurrentStyle** p);

Property values

Type: Object

the cascaded style of the object.

Remarks

The values returned by the properties of the IHTMLStyle and IHTMLCurrentStyle interfaces differ when the style of an object is not set inline. For example, if the author of a Web page sets the IHTMLCurrentStyle::color property of a paragraph to red only through a linked or embedded style sheet, and not inline, then the IHTMLCurrentStyle::color property returns the value red, and the IHTMLStyle::get_color property does not return a value. However, if the author specifies the value of the IHTMLCurrentStyle::color property inline, as in the following example, both the IHTMLCurrentStyle::color and IHTMLStyle::get_color properties return the value red.

<p style="color:'red'">

In Windows Internet Explorer 8 and earlier, the IHTMLElement2::currentStyle property returns E_MEMBERNOTFOUND if script attempts to write to it.

See also

style