Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you link to a CSS file from an email?

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?

like image 879
Josh Curren Avatar asked Jan 20 '10 23:01

Josh Curren


People also ask

How do you link an email in CSS?

Email links use the mailto: attribute along with the HRef attribute and the recipient's email address to accomplish this function. Clicking on a mailto: link opens your email software and inserts the email address into the To field.

Can you use CSS in email?

CSS will work in HTML email but it has limitations. In general, very simple CSS is always best when you code for email. These are our recommendations for how to use CSS in HTML email and some information to help you troubleshoot CSS-related issues.


1 Answers

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.

like image 127
bobince Avatar answered Oct 22 '22 05:10

bobince