I would like to get in my JS code the “original” CSS width property applied to the element, and not the runtime width (calculated).
eg.
.foo {
width: 50%
}
in this case, I want to get "50%", not the px value computed at runtime. If the value is given in em, I want to get em as the result.
window.getComputedStyle(foo, null).getPropertyValue('width'), returns the pixel value (at least on google chrome).
Actually, I need the text value of the CSS rule applied to the element.
source
share