Get information about HTML elements in .NET.

I am just wondering if there is a way to get information about an element in HTML in my .NET application. The input is an HTML page and path to CSS files, etc. I want to take for example. H1 and found there would be CSS for it. Is there any code or can I use IE and try to extract this information from it automatically in my application?

+2


source to share


2 answers


Using jQuery you can easily get it like this:

var styleToApply = $("#myH1Tag").attr("style");

      



You can use this for any tag and associated attributes. You can even add your own if you like.

0


source


You can host an IE COM object from your application, navigate to the page you want, and use the currentStyle object from your .NET code (by searching the DOM for the element you want ).



This is a pretty tricky scenario, but it can be done!

0


source







All Articles