Challenge making table cells responsive in custom modules

I’m creating some two-column tables for a custom email module that I’d like to stack on mobile devices. According to this Hubspot Developer Doc, one should only have to follow this method:

When working with HubSpot’s responsive layout, any <td> with a class that includes the text “column” will be made responsive.

I’ve done this, but the columns continue to be side-by-side, regardless of viewport size.

Code sample:

<style type="text/css" id="hs-inline-css"> #em-two-column-testing td { color: {{ site_settings.primary_font_color }}; font-family: {{ primary_font }}; padding: 1rem; }</style><table id="em-two-column-testing" cellpadding="0" cellspacing="0" border="0" class="templateColumnWrapper" style="background-color:#ffffff;margin:auto;width:100%"> <tr> <td id="column-one" class="column" colspan="6" valign="top" width="50.0%"> {{ module.copy }} </td> <td id="column-two" class="column" colspan="6" valign="top" width="50.0%"> {{ module.copy }} </td> </tr></table>

Are you building this module for a custom coded template or for drag and drop?

If this is for a custom coded template you need to ensure the template contains the responsive markup included in the documentation right below the note you mentioned. When you create an email template file in the design manager it gives only the basic markup by default, not the responsive markup.

If this is for a drag and drop email then this documentation is of little use. As far as I’m aware HubSpot has yet to create documentation specifically for coding email modules for drag and drop. I’ve learned from tinkering around though that for drag and drop you can use “hse-column” and “hse-size-#” to dictate responsive columned layouts for drag and drop.

<style type="text/css" id="hs-inline-css">
 #em-two-column-testing td {
 color: {{ site_settings.primary_font_color }};
 font-family: {{ primary_font }};
 padding: 1rem;
 }
</style>

<table id="em-two-column-testing" cellpadding="0" cellspacing="0" border="0" class="templateColumnWrapper" style="background-color:#ffffff;margin:auto;width:100%">
 <tr>
 <td id="column-one" class="hse-column hse-column-6" valign="top">
 {{ module.copy }}
 </td>
 <td id="column-two" class="hse-column hse-column-6" valign="top">
 {{ module.copy }}
 </td>
 </tr>
</table>

Note: In either of these cases you won’t be able to see the responsiveness by just previewing the module, you need to actually view it in the template/email.

Thank you @alyssamwilie for the quick response. I’m building a custom module for use in the drag-and-drop email builder. That rules out the documentation (as you’ve said).

I did try your suggestion (adding classes of: hse-column and hse-column-6, but it didn’t work.

 <table id="em-two-column-testing" role="presentation" dir="rtl" cellpadding="0" cellspacing="0" border="0" class="templateColumnWrapper" style="background-color:#ffffff;margin:auto;width:100%">
 <tr>
 <td id="column-one" class="hse-column hse-column-6" dir="ltr" valign="top">
 <h2>Right (Top)</h2>
 <p>{{ module.copy }}</p>
 </td>
 <td id="column-two" class="hse-column hse-column-6" dir="ltr" valign="top">
 <h2>Left (Bottom)</h2>
 <p>{{ module.copy }}</p>
 </td>
 </tr>
 </table>

Sorry, it’s been awhile since I’ve done an email. The reason the above doesn’t work is because hse-column and hse-size are to be used on <div>s, not <table> markup. HubSpot uses hybrid coding so as to make emails as uniform across as many email clients as possible. This means that a single section will usually contain:

1. MSO/IE only table markup

2. A div for responsive columns (this is where the hse-column, hse-size classes will be set)

3. Table markup for the actual content

This can get pretty crazy looking. This is the base code I use for two column layouts:

 <!--[if (mso)|(IE)]>
 <table align="center" style="width:600px;" cellpadding="0" cellspacing="0" role="presentation" width="600">
 <tr>
 <![endif]-->

 {# Column One #}

 <!--[if (mso)|(IE)]>
 <td valign="middle" style="width:300px;">
 <![endif]-->

 <!--[if gte mso 9]>
 <table role="presentation" width="300" cellpadding="0" cellspacing="0" style="width:300px">
 <![endif]-->

 <div class="hse-column hse-size-6" style="vertical-align: middle;">
 <table role="presentation" cellpadding="0" cellspacing="0" width="100%" style="border-spacing:0 !important; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt">
 <tbody>
 <tr>
 <td class="hs_padded" style="">
 CONTENT HERE
 </td>
 </tr>
 </tbody>
 </table>
 </div>

 <!--[if gte mso 9]>
 </table>
 <![endif]-->
 <!--[if (mso)|(IE)]>
 </td>
 <![endif]-->

 {# Column Two #}

 <!--[if (mso)|(IE)]>
 <td valign="middle" style="width:300px;">
 <![endif]-->

 <!--[if gte mso 9]>
 <table role="presentation" width="300" cellpadding="0" cellspacing="0" style="width:300px">
 <![endif]-->

 <div class="hse-column hse-size-6" style="vertical-align: middle;">
 <table role="presentation" cellpadding="0" cellspacing="0" width="100%" style="border-spacing:0 !important; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt">
 <tbody>
 <tr>
 <td class="hs_padded" style="">
 CONTENT HERE
 </td>
 </tr>
 </tbody>
 </table>
 </div>

 <!--[if gte mso 9]>
 </table>
 <![endif]-->
 <!--[if (mso)|(IE)]>
 </td>
 <![endif]-->

 <!--[if (mso)|(IE)]>
 </tr>
 </table>
 <![endif]-->

Thank you @alyssamwilie! Looks like that might work. Most work arounds involved media queries, but those don’t persist from the module into the final email. This accounts for email client “weirdness” and appears to render in most trials. Cheers!