c# - Remove attributes like width inside a style element -


i need remove width inside of style element, pref using html agility pack.

i tried using:

public static void removestyleattributes(this htmldocument html) {    var elementswithstyleattribute = html.documentnode.selectnodes("//@style");     if (elementswithstyleattribute!=null)    {       foreach (var element in elementswithstyleattribute)       {          element.attributes["style"].remove();       }    } } 

but have been unable target single element inside of style (since not want remove style entirely)


Comments