Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Miriam Tocino
Miriam Tocino
14,031 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,031 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.