Can you link to a CSS file from an email?

HtmlCssEmailStylesheet

Html Problem Overview


When sending an HTML email can you link to an external style sheet or does the CSS need to be included in the email?

Also, if you can link to an external style sheet, which way is more efficient/is smarter to use: linking to the style sheet or including it in the HTML?

Html Solutions


Solution 1 - Html

Forget efficient. Forget smart. Forget maintainable. This is HTML mail we're talking about.

HTML mail and Webmail clients are extremely limited, partly for security reasons but mainly because they're just rubbish. External style sheets almost certainly won't work. HTML-embedded style sheets probably won't work. Inline style="..." attribute on every damn element... has a much better chance of working, but still, don't be surprised when many users can't see styles at all, or some styles don't work, or some basic HTML doesn't work, and the content ends up looking like a 1997 browser threw up all over it.

HTML mail is an exercise in unpleasantness. I hate to receive it. I hate even more to author it. The sanest route for everyone is to forget HTML mail and just send a plain text message including a link to a full web page, where you can have as much CSS, JavaScript and Flash loveliness as you like.

Solution 2 - Html

Can you? Yes.

Should you? No. Most likely the email client will block external links and therefore your mail will not appear as you think it should.

If you must send html mail, embed everything into the email message itself. External links which automatically call back to the home server to load additional resources are one thing spam filters don't like.

Solution 3 - Html

You're best off embedding the CSS in your HTML.

I believe inline styles (added in a style attribute on each element) are more widely supported than including a <style> section, too.

I just Googled and came across this tutorial - looks pretty good at first glance... http://articles.sitepoint.com/article/code-html-email-newsletters

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJosh CurrenView Question on Stackoverflow
Solution 1 - HtmlbobinceView Answer on Stackoverflow
Solution 2 - HtmlNotMeView Answer on Stackoverflow
Solution 3 - HtmlChris RobertsView Answer on Stackoverflow