Reputation: 13
as we know that with window.getComputedStyle() method we can get the computed styles of specific element. (see https://jsfiddle.net/r7sgpyt5/1/). My question is,how can we know where the CSSStyleDeclaration in the computed style come from.for example in https://jsfiddle.net/r7sgpyt5/1/ I have define a css rule like:
#element{
color:red;
border:1px solid #999;
margin:10px;
}
if I use getComputedStyle(element,null).getPropertyValue("color") it returns "rgb(255, 0, 0)",but how can I know the property "color" is defined in the css selector "#element".
Thx!
Upvotes: 1
Views: 403
Reputation: 16
@Tsingbo, as far as I know it's impossible, but you can try window.getMatchedCSSRules in Chrome.
Upvotes: 0