I need to get a cascaded style value of an element (not the computed one), or to determine whether the actual value was computed or not.
For example, if I have an element with css rule width: 100%
, I want to get the value 100%
and not the actual pixels value, or just to know that the actual value was computed.
I know that I can get it using elem.currentStyle
, and I also found a way in Chrome to find it using document.defaultView.getMatchedCSSRules()
.
Does anyone know a way to get it in other browsers?
What about calculating the value yourself? Query the calculated width of the wanted element and the calculated width af the parent element and then do some math to get the percentage-value?
percentageValue = 100% * widthOfWanted / widthOfContainer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With