I am stuck trying to remove a style definition from the style attribute of a DIV element. HTML code:
<div class="el1" style="width:800px; max-width:100%" /> ... <div class="el2" style="width:800px; max-width:100%" /> There may be more than 1 of these elements that I need to apply the manipulation to.
Here is what I have thus far using HtmlAgilityPack.
foreach (HtmlNode div in doc.DocumentNode.SelectNodes("//div[@style]")) { if (div != null) { div.Attributes["style"].Value["max-width"].Remove(); //Remove() does not appear to be a function } } My thought process was to select any with a style attribute. Look for a max-width definition and remove it.
Any guidance on how this can be achieved?
stylevalue. From there on you can remove themax-widthby using a reg-ex or some other diabolical contraption and finally set it back on the attribute.