author: Krasimir Tsonev

Krasimir is a blogger, who writes and speaks.
He loves open source and codes awesome stuff.

Get computed css styles for a given element

I just found out that it is possible with pure javascript. It's supported in all the major browsers. Find more information here.

getComputedStyle(document.querySelector("h1"), null);
Getting the background style for example:
getComputedStyle(document.querySelector("h1"), null).background;

blog comments powered by Disqus