/

HTML / CSS / JavaScript Tutorial

JavaScript Window method: getComputedStyle()

[this page | pdf | back links]

The getComputedStyle() method (when applied to Window objects in the JavaScript BOM) returns the current computed CSS styles applied to a specified element.

 

It has the following syntax with the following parameters. It returns a CSSStyleDeclaration object.

 

window.getComputedStyle(element, pseudoelement)

 

Parameter

Required / Optional

Description

element

Required

Element to get computed style for

pseudoelement

Optional

Pseudo-element

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile