Get current style using MSHTML in C #

I want to use MSHTML to get the html element style.

What I want is a computed style, but without all the defaults. (only those installed in html and css)

MSHTML has 3 types of styles that I have seen so far, style, currentStyle and runtimeStyle.

Style

and runtimeStyle have only inline styles, and the current style has everything, including inherited and default styles.

Is there a way to get the current style (inline, external and internal css), but without all the inherited and default values?

There should be a way to do this, the IE developer toolbar seems to know which styles are inherited from that place.

+5
source share
1 answer

When you say that you want to exclude "default" and / or inherited properties, unlike inline, external and internal CSS, which is not entirely correct, since the default properties are set using user-agent css.

I would suggest that one of the ways to filter the default properties from the explicitly applied ones will be to compare at runtime the element displayed on the page using the css / inline style and the same element that is displayed in the same DOM structure without external CSS and with inline styles; possibly inside a hidden iframe, etc. Does this make sense?

Depending on your comfort level, you might be lucky to look into the sources of Firebug Lite .

0
source

All Articles