2

I need to update an old email template. In the old template, which are like 4-5 years old, I found stuff like

<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="bodyTable">

Now I am not sure why they used the those syntax, just because it is old, or is there any other mail-template related reason? Can I change them without any concern into, let's say:

<table style="text-align:center;border:0;height:100%; width:100%" class="bodyTable">

If not, can someone maybe explain to me why?

yangsunny
  • 656
  • 5
  • 13
  • 32
  • if you want you can change, no issues – OM PRAKASH Jul 09 '19 at 14:47
  • _“If not, can someone maybe explain to me why?”_ - that alone would justify closing this question as too broad IMHO. HTML e-mail is a complex topic, at lot has been written about that already - so please do some proper reading up on the topic, if you run into any issues. – misorude Jul 09 '19 at 14:48
  • 3
    Emails clients are not good at rendering HTML, using the old HTML attributes may be a more reliable solution if the recipients might be using older versions of email clients – metaDesign Jul 09 '19 at 14:52
  • Read the long answers below, in short: Outlook is the most troublesome email client and doesnt ready styles on elements the right way. I advice to keep it but ditch `height="100%"`. it has weird outcomes in Apple mail (atleast in Litmus) – Syfer Jul 10 '19 at 07:04

2 Answers2

6

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.

Serge
  • 3,387
  • 3
  • 16
  • 34
  • 1
    Another great resource is campaign monitors css support list found here: https://www.campaignmonitor.com/css/tables/table-layout/. – Syfer Jul 10 '19 at 07:49
0

If you host the CSS I think the link tag works as google can't change whats in the link. as in <link rel="stylesheet" href="https://yoursite.com/emailCSS.css">