【问题标题】:Make css styles inline into html elements将 css 样式内联到 html 元素中
【发布时间】:2015-06-03 00:16:09
【问题描述】:

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

这类似于"Compile" CSS into HTML as inline styles - 但我想在 c# 中完成

【问题讨论】:

    标签: c# html css xslt


    【解决方案1】:

    您可以使用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.
    

    【讨论】:

      猜你喜欢
      • 2015-05-14
      • 2013-12-06
      • 2020-11-26
      • 2012-12-17
      • 2021-01-14
      • 2021-09-17
      • 2011-07-04
      • 2020-03-24
      • 1970-01-01
      相关资源
      最近更新 更多