Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET convert external CSS to inline CSS [closed]

Tags:

.net

css

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.

like image 882
brechtvhb Avatar asked Feb 21 '11 13:02

brechtvhb


People also ask

Why is inline CSS a bad idea?

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.

Do inline styles override stylesheets?

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.

Does inline CSS override internal?

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.


1 Answers

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:

like image 165
benedict_w Avatar answered Sep 29 '22 10:09

benedict_w