我想编译css并将每个标记的结果样式替换为html中相应标记的内联样式。在c#中有一种简单的方法吗?
这类似于"Compile" CSS into HTML as inline styles - 但我想在c#
中这样做答案 0 :(得分:4)
您可以使用https://github.com/milkshakesoftware/PreMailer.Net
string htmlSource = File.ReadAllText(@"C:\Workspace\testmail.html");
var result = PreMailer.MoveCssInline(htmlSource);
result.Html // Resultant HTML, with CSS in-lined.
result.Warnings // string[] of any warnings that occurred during processing.