VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-window-getcomputedstyle-method/

⇱ JavaScript Window getComputedStyle() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Window getComputedStyle() Method

Last Updated : 11 Jul, 2025

The getComputedStyle() method is used to get all the computed CSS property and values of the specified element. The use of computed style is displaying the element after stylings from multiple sources have been applied. The getComputedStyle() method returns a CSSStyleDeclaration object. 

Syntax:

window.getComputedStyle(element, pseudoElement)

Parameters:

  • element: The element to get the computed style for
  • pseudoElement: A pseudo-element to get. this is an optional parameter.

Example: Return font-family of text in div. 

Output: 

👁 JavaScript Window getComputedStyle() Method
JavaScript Window getComputedStyle() Method

Supported Browsers: The browser supported by Window getComputedStyle() Method are listed below:

  • Google Chrome 1.0
  • Edge 12.0
  • Internet Explorer 9.0
  • Firefox 1.0
  • Opera 7.2
  • Safari 3

We have a complete list of HTML and Window methods, to check those please refer to this HTML DOM Complete Reference article

Comment
Article Tags: