0

I'd like to compile css and replace the resulting styles for each tag as an inline style for the corresponding tags in html. Is there a simple way to do this in c#?

This is similar to "Compile" CSS into HTML as inline styles - but I want to do it in c#

1 Answer 1

4

You can use 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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.