I'm looking for a tool that converts external CSS to inline CSS. The resulting HTML is used in e-mail and for PDF creation.
One of the main reasons that inline styling is not a good choice for your application is because it does not support (or it has really poor support) for CSS features. Every application nowadays might have to end up using some selectors such as :hover , :active , :focused , etc.
Inline styles added to an element (e.g., style="font-weight: bold;" ) always overwrite any normal styles in author stylesheets, and therefore, can be thought of as having the highest specificity.
It works kind of counter-intuitively, so just to explain further: inline styles override internal CSS, and internal CSS overrides external CSS files, and external CSS files override browser defaults. One way to think about it is like layers. The “closer” the style is to the element, the higher precedence it has.
Premailer.Net should do the trick it's written in C#
C# .Net library, that moves your stylesheets to inline style attributes, for maximum compatibility with E-mail clients.
Here is the Git repo: https://github.com/milkshakesoftware/PreMailer.Net:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With