IViewCSS.GetComputedStyle

GetComputedStyle(Element)

The IViewCSS.getComputedStyle() method returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.

Individual CSS property values are accessed through APIs provided by the object, or by indexing with CSS property names.

public ICSSStyleDeclaration GetComputedStyle(Element element)
ParameterTypeDescription
elementElementThe Element for which to get the computed style. This parameter cannot be null.

Return Value

The returned style is a live CSSStyleDeclaration object, which updates automatically when the element’s styles are changed.

Exceptions

exceptioncondition
TypeErrorIf the passed object is not an Element or the pseudoElt is not a valid pseudo-element selector.

Remarks

CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.

Reference

CSS Working Group - The CSS Working Group is the W3C working group chartered to develop Cascading Style Sheets (CSS).CSS Object Model (CSSOM) - CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.CSS Object Model (CSSOM) # dom-window-getcomputedstyle – The CSSOM definition.

See Also


GetComputedStyle(Element, String)

The IViewCSS.getComputedStyle() method returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.

Individual CSS property values are accessed through APIs provided by the object, or by indexing with CSS property names.

public ICSSStyleDeclaration GetComputedStyle(Element element, String pseudoElement)
ParameterTypeDescription
elementElementThe Element for which to get the computed style. This parameter cannot be null.
pseudoElementStringA String specifying the pseudo-element to match. Omitted (or null) for real elements.

Return Value

The returned style is a live CSSStyleDeclaration object, which updates automatically when the element’s styles are changed.

Exceptions

exceptioncondition
TypeErrorIf the passed object is not an Element or the pseudoElt is not a valid pseudo-element selector.

Remarks

CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.

Reference

CSS Working Group - The CSS Working Group is the W3C working group chartered to develop Cascading Style Sheets (CSS).CSS Object Model (CSSOM) - CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.CSS Object Model (CSSOM) # dom-window-getcomputedstyle – The CSSOM definition.

See Also