What HTML/CSS Attributes Are Mail Safe

What html/css attributes are mail safe?

Here are a couple of posts to get you started:

http://css-tricks.com/using-css-in-html-emails-the-real-story/

http://www.sitepoint.com/code-html-email-newsletters/

Safe markup for HTML email

In general you want to stick to 10+ years old HTML.

Avoid trying to link to external stylesheets and avoid styles in the HEAD.

Use inline styles.

Use HTML tables for layout.

Industry standard is to stick to width of 600px or less for your email content.

This is a good guide: http://kb.mailchimp.com/article/how-to-code-html-emails

Protect e-mail address with CSS only

It's very simple. You can protect your email address with only HTML & CSS. You don't need to know about PHP or Java script. Try below code.

Simple HTML and CSS code:

<!doctype html>
<html>
<head>
<title>Protect e-mail with only css</title>
<style type="text/css">
.e-mail:before {
content: attr(data-website) "\0040" attr(data-user);
unicode-bidi: bidi-override;
direction: rtl;
}
</style>
</head>
<body>

<span class="e-mail" data-user="nohj" data-website="moc.liamg"></span>

</body>
</html>

Output of above code:

jhon@gmail.com

Please note:

Here I'm just used two extra attributes.

1) data-user write your e-mail id user name in reverse.

2) data-website write your e-mail id website in reverse.

CSS in HTML Email

It is, or at the least was, the recommended style for HTML emails. For instance, "HTML attributes instead of CSS" are advised by Smash Magazine. While CSS support is gradually improving, there is no universal HTML email standard, so each email client supports its own subset of HTML/CSS. Thus, email designers are advised to 'think 99' or post-process their email templates with special inlining/downgrading tools, such as
http://premailer.dialect.ca (and a few others).

I'd say CSS has been well supported by major email clients for several year, yet, say in 2011 I find occasional stackoverflow complains of gmail.com stripping styles attributes HTML email in Gmail - CSS style attribute removed.

So I guess authors opted to play save. It is not uncommon for companies to care even of users stuck with somewhat outdated software.

According to this list, the major and current email clients support the style attribute well. Still, there is always a risk that a particular tag, attribute, or their combination are not supported by a less know email client, sometimes due to a bug or a corner case, as you can see in a relatively recent post regarding Spark client HTML Email formatting stripped out.

Is safe to put html style tag into body tags coding html emails?

It seems client dependent. Check out a similar answer here.

Some clients will support the use of styling in the body, but generally not in the head. Since there is really no way to incorporate css, it makes sense that this would be the case.

Do HTML email templates require the use of the style attribute?

Yes, for example google gmail won't handle the STYLE element in the HEAD.

Look at this site for email clients and what they can/can't do regarding css: http://www.campaignmonitor.com/css/

Can all the CSS for HTML emails css go in the head?

inline CSS is the most preferred for email templates, because not all email clients support CSS in head section

Here is Guide to CSS support in email

Can I put a style.../style tag within the body of a HTML file to send in email?

The short answer is no. Gmail strips the tag and it's content.

Hotmail, Yahoo! Mail and Windows Live Mail does not strip style-tags in the body-element.

But take a look at "The Ultimate Guide to CSS" for HTML email over at Campaign Monitor.



Related Topics



Leave a reply



Submit