【发布时间】:2015-06-03 00:16:09
【问题描述】:
我想编译css并将每个标签的生成样式替换为html中相应标签的内联样式。有没有一种简单的方法可以在 c# 中做到这一点?
这类似于"Compile" CSS into HTML as inline styles - 但我想在 c# 中完成
【问题讨论】:
我想编译css并将每个标签的生成样式替换为html中相应标签的内联样式。有没有一种简单的方法可以在 c# 中做到这一点?
这类似于"Compile" CSS into HTML as inline styles - 但我想在 c# 中完成
【问题讨论】:
您可以使用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.
【讨论】: