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 Building Common Design Patterns

Juan Luna
Juan Luna
11,483 Points

Why we put another <table> in the #eventContainer and #merchandiseContainer?

Hi, I was following the video but now I'm a little lost, I did the introductionContainer and the callToActionContainer with a <table element that set their width and then putting table rows and table data inside of them. But I see that eventContainer and merchandiseContainer something different: They have a <table with the width and then another <table with width:100%; why is that? how can I know when I should do that?

An example; this is the HTML code for the callToActionContainer (with just one <table inside the main <td>)

<tr>
                                <td align="center" valign="top" id="callToActionContainer">

                                    <!-- // BEGIN CALL-TO-ACTION BLOCK -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="520" id="callToActionBlock">
                                        <tr>
                                            <td align="center" valign="top" class="callToActionContent">
                                                <h3>The Works of Édouard Manet:<br />A Live Tour With Clémence Rousseau</h3>
                                                <br />
                                                Friday nights at 8:00PM throughout the exhibition, French art critic and Manet expert Clémence Rousseau will be examining the 6 pieces featured, providing deep insights into Manet’s genius and his beautiful artwork. Register early, as space is limited.
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="center" valign="top">
                                                <table border="0" cellpadding="0" cellspacing="0" class="callToActionButton">
                                                    <tr>
                                                        <td align="center" valign="top" class="callToActionButtonContent">
                                                            <a href="#" target="_blank" title="square gallery">Register Now</a>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- //END CALL-TO-ACTION BLOCK -->

                                </td>
                            </tr>

And this is the example for the eventContainer (with two <table before the content)

<tr>
                                <td align="center" valign="top" id="eventContainer">

                                    <!-- // BEGIN EVENT BLOCK -->
                                    <table border="0" cellpadding="0" cellspacing="0" width="600" id="eventBlock">
                                        <tr>
                                            <td align="center" valign="top" id="eventBlockCell">
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                    <tr>
                                                        <td align="left" valign="top" class="eventBlockHeading">
                                                            <h2>Upcoming Events</h2>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="center" valign="top">
                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td align="center" valign="top">
                                                                        <table border="0" cellpadding="0" cellspacing="0" width="110" class="eventBlockCalendar">
                                                                            <tr>
                                                                                <td align="center" valign="top" class="eventBlockMonth">
                                                                                    NOV
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td align="center" valign="top" class="eventBlockDay">
                                                                                    7
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                    <td align="left" valign="top" class="eventContent">
                                                                        <h3>localArTLanta</h3>
                                                                        <strong>Running November 7 through December 14</strong>
                                                                        <br />
                                                                        An exhibition of Atlanta’s finest local artists in a broad selection of media ranging from painting to sculpture to perfomance art.
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- END EVENT BLOCK // -->

                                </td>
                            </tr>

Thanks :)

1 Answer

Edison Jimenez
Edison Jimenez
2,670 Points

I look nested html tables as layouts in normal html/css pages. So, the more nested tables you have in an html email section, the more customizable that section is. Of course you can avoid those nested tables depending on the complexity of your message (images and text arrangement).

For instance, look at this apple email (http://becsrivett.com/christmas-email-win-tiffany-and-co-and-apple/). It requires mores nested table in order to control where every element (image/text) shouled go in every section.

I hope this will helps you.