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

HTML

Miriam Tocino
Miriam Tocino
14,201 Points

HTML Email Design | <center> tag

I just started the new course HTML Email Design and found the teacher using the "center" tag for the design. I would like to know if using this tag for the email is still safe when talking about email design, as this tag is is deprecated in HTML 4.01 and not supported in HTML5. They recommend to use CSS instead. Thanks!

4 Answers

martin watson
martin watson
5,983 Points

I don't see any problems in using the center tag as he was using strict XHTML 1.0. But personally I have found using an align center attribute (see below) in the td (table cell) the best way of aligning emails consistently across major email clients.

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="center">
            Your Content
        </td>
    </tr>
</table>

Also here is a little guide on what Email clients support what CSS selectors http://www.campaignmonitor.com/css/

Miriam Tocino
Miriam Tocino
14,201 Points

Thanks guys! The reference to that table turned out to be very helpful! ;)

Jeremy Smith
Jeremy Smith
1,395 Points

I don't actually know with what other CSS they have created, but largely it's a bad idea I would have thought, that stems from the old presentation when CSS wasn't around I believe.

I mean to centre a page you'd use auto for the margin property of a selector (I think I got that right lol).

Hope this answers your question?

Jeremy Smith
Jeremy Smith
1,395 Points

In more detail I would say that I suppose if you'd have some CSS properties (or something like that) conflicting it could harm the presentational layout of the page, but really in essence it's just not a very good thing. They probably didn't realise (your teacher that is) didn't realize how to center elements on a page using pure CSS.

I come from a programming (PHP pretty much and ecommerce back office admin perspective) so this is all pretty much new to me. But judging by what I have heard in the past I would think would be their response.

James Barnett
James Barnett
39,199 Points

> They probably didn't realise (your teacher that is) didn't realize how to center elements on a page using pure CSS.

HTML Email design is a world onto itself. As email clients don't support much CSS for layouts.