25.300. Window.getComputedStyle( ): retrieve the CSS styles used to render an elementDOM Level 2 CSS:25.300.1. SynopsisCSS2Properties getComputedStyle(Element elt, String pseudoElt); 25.300.1.1. Arguments
25.300.1.2. ReturnsA read-only CSS2Properties object that represents the style attributes and values used to render the specified element in this window. Any length values queried from this object are always expressed as pixel or absolute values, not relative or percentage values. 25.300.2. DescriptionAn element in a document may obtain style information from an inline style attribute and from any number of style sheets in the stylesheet "cascade." Before the element can actually be displayed in a view, its style information must be extracted from the cascade, and styles specified with relative units (such as percentages or "ems") must be "computed" to convert to absolute units. This method returns a read-only CSS2Properties object that represents those cascaded and computed styles. The DOM specification requires that any styles representing lengths use absolute units such as inches or millimeters. In practice, pixel values are commonly returned instead, although there is no guarantee that an implementation will always do this. Contrast getComputedStyle( ) with the style property of an HTMLElement, which gives you access only to the inline styles of an element, in whatever units they were specified, and tells you nothing about stylesheet styles that apply to the element. In Internet Explorer, similar functionality is available through the nonstandard currentStyle property of each HTMLElement object. 25.300.3. See AlsoCSS2Properties, HTMLElement |