Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Design HTML Email Design Coding HTML Email Coding with Limited HTML

Frank Otto
Frank Otto
2,433 Points

Which is the best DOCTYPE to use?

In your HTML email you use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

However, I have read that using the transitional doctype is the best:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Why did you decide to go with strict as opposed to transitional?

2 Answers

Nick Weight
Nick Weight
1,890 Points

This is an old post, but I thought I'd add my two cents.

Going with strict is fine however you need to be prepared for it. For example font tags and bgcolor won't be recognized using strict. I prefer to use bgcolor as a fallback in case the style does not work. In other words, it might cause some issues for you with deprecated tags.

Also while gmail is one of most popular esps it is also one of the most problematic (along with outlook). Biggest reason being it strips out any media queries and internal style sheet styles by default. Unfortunately it is the necessary evil in the email world.

Hi Frank,

The main reason why he used the strict over the transitional is because most email providers are very picky when it comes to reading html. Most email providers are getting up to date and transitional is being use more frequently. The only drawback is that if your client has an older browser or email provider (older mail app or others), it might cause the file to be render differently to the end user. Thus making the strict more variable across platforms.

Hope that helps!

Frank Otto
Frank Otto
2,433 Points

Thanks for the information Victor!

I've noticed that in my emails the Gmail App on androids renders my emails differently from everything else. Do you think it could be because I'm using transitional over strict?

It could be that, sometimes you have to test and fix. It varies for mobile devices because some have new updated software and some don't. It is hard to make sure the emailblast works because you have to do intensive testing.