将基于类的样式更改为内联样式

Change class based styles to inline styles

本文关键字:样式 于类      更新时间:2023-09-26

是否有一种服务可以将基于类的样式更改为内联样式?我需要设计一个电子邮件和工作与类是迄今为止更容易和更快,但一切都必须改变内联样式在最后。似乎应该有一个程序可以做到这一点,但我似乎找不到任何东西。

  <table class="g">
    <tr>
        <td>
            <p>
                content should be bright green
            </p>
            <span>
                content should be red and bold
            </span>
        </td>
    </tr>
</table>
<style>
table.g p{
    color:#3f0;
}
table.g span{
    color:#f00;
    font-weight:bold;
}
</style>

是否可以自动更改为

<table>
    <tr>
        <td>
          <p style="color:#3f0;">
                content should be bright green
            </p>
            <span style="color:#f00;font-weight:bold;">
                 content should be red and bold
            </span>
        </td>
    </tr>
</table>

使用某种软件,了解如何应用CSS规则,并可以自动转换它们?

*标记与javascript和jquery的情况下,有一种方法做到这一点使用。

  • 应用:
    • http://beaker.mailchimp.com/inline-css
  • Python:
    • https://github.com/davecranwell/inline-styler
    • https://github.com/rennat/pynliner
    • https://github.com/peterbe/premailer(将相对路径改为绝对路径)
  • PHP:
    • https://github.com/tijsverkoyen/CssToInlineStyles
    • https://github.com/christiaan/InlineStyle(允许使用外部CSS样式表)
  • Ruby:
    • https://github.com/maca/inline-style
    • https://github.com/purify/mail_style(纠正img标签中的src attr)
  • JavaScript:
    • https://github.com/LearnBoost/juice
    • https://npmjs.org/package/grunt-email-builder (Grunt.js插件)
    • https://github.com/jonkemp/gulp-inline-css
  • c#
    • https://github.com/milkshakesoftware/PreMailer.Net