繁体   English   中英

使CSS样式内联到html元素中

[英]Make css styles inline into html elements

我想编译CSS并将每个标签的结果样式替换为html中相应标签的内联样式。 在C#中有没有简单的方法可以做到这一点?

这类似于将CSS作为内联样式“编译”为HTML-但我想在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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM