0

I am altering an html email template created by previous designer. It doesn't look right to me:

<html style="margin: 0;padding: 0;border: 0;width: 100%;height: 100%;">
<head>
</head>
<style type="text/css">

I would have thought 'style' goes into 'head' and 'html style="..." looks confusing. I am not an expert on html emails, just thought somebody here might be more knowledgeable Also is there meant to be a doctype?

1
  • Yeah, that's uncommon. Commented Feb 25, 2015 at 14:44

2 Answers 2

1

This was likely done because many email clients strip out the head element. However, the style element should go in the body element at point. The only supported child elements of html are head and body. Of course, even then, many email clients also strip out style elements, so really all CSS in an email template should be inline for maximum compatibility.

Sign up to request clarification or add additional context in comments.

Comments

0

Newsletter code is based on tables and all its styles are placed inline. Code like this looks archaic but there is a good reason for this - most email services don’t allow for proper positioning and shaping the format using such tags as div, section etc. and that’s why tables are used to build a newsletter.

See: http://freshmail.com/developers/best-practices-for-email-coding/ for a reference of what styling can and cannot be used. The guide includes also advice for newsletter designers and developers regarding Responsive Email Design

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.