roberto tomás
roberto tomás

Reputation: 4687

copy CSS styles that apply to an element

I want to be able to get as output to the console (or something like this) all the style rules that apply to an element. Such that for example $(_element_).css_styles(); generates output like:

How can I get this?

edit: I built a jfiddle that looks good.

Upvotes: 0

Views: 141

Answers (1)

SomeKittens
SomeKittens

Reputation: 39512

If you're on Chrome, you can use getMatchedCSSRules(element). If you're on FireFox (or another Gecko browser), a polyfill is available.

Upvotes: 2

Related Questions