Add These Two Innovative Email Layout Techniques to Your Toolbox
Chances are, if you're reading this blog you know the challenges email developers face with finding adaptable email layouts. It therefore comes as no surprise that email developers are constantly trying to innovate on and perfect the layouts of their emails. In this blog, I'll be looking at two innovative email layout techniques, their advantages and disadvantages, and how they fare with real content.
Table of content
The Max-Width Method
Currently, the most common technique of structuring an email is to have a 100% width table as the container, with a centered cell inside. Within that cell we have a table with a max-width to control the width of the email's content. Structuring a table like this means we need to employ a 'ghost table' due to Outlook's lack of support for max-width. The centered table will float in the middle of the email on screens wider than the max-width (usually around 600px), and it will shrink to fit smaller spaces, like mobile devices or narrow browser windows.The table of your dreams
The first technique we're going to look at was posted online by Mark Robbins on the Rebelmail blog, aptly named "The table of your dreams." Mark claims that by using a three column structure with a set width on the middle column, we can emulate the much used margin:0 auto; centering technique for web development. Before we even get into the nitty gritty of the code, we need to test the example provided. I dropped the code through our Email on Acid testing platform and was pleased with the results. It plays nice on all the major email clients, even the normally tricky ones. I see green ticks for the Gmail App and all the Outlooks. On top of that, it looks good on all the major mobile devices. So, let's have a look at how and why we'd employ this technique. Using Mark's table structure obviates the need for max-width and ghost tables to control the layout. By having a 100% width table with a hard width on a cell, while the other two are blank means that the two either side will fill the rest of the email, forcing the hard width cell to be centered on all devices. This also means that we can use the cells either side to force "wonky" layouts by offsetting the number of cells either side I know what you're thinking; "What about mobile layouts? There's nothing to force it to be mobile!" the clever part of this code, is that once the width of the viewport is less than the width of the hard width cell in the middle, it uses the 100% width of the overall table as an override of the hard width we put in It sounds like a winner to me. Less code for our structure, a bit more bullet proof and less future proofing! But, it's all too often with these code examples that we can forget the bigger picture and get too excited about the code. We need to see what it looks like with real content in. I mocked up a really simple layout to test how it stood up with real content, as seen below. Once again, I ran this through our testing software. I was pleasantly surprised to find it worked in a lot of places. The one place it seems to fall down is on mobile. This may seem like a big drawback, but looking at the results all it really needs to make it user-friendly is some mobile enhancements. I have to stress that I only ran very basic tests on the code for base usability. So, what's the final verdict on 'The table of our dreams'? I found the code to be very nice to work with. I plan to play with it more, too. The simplicity is definitely a big plus and something we'll be looking to work into our own hybrid structure. This code won't change the email world, but it could simplify your table structures.The Fab Four technique
The next code sample we'll be looking at is the Fab Four technique, originally devised by email wizard Rémi Parmentier. He claims to be able to code responsive emails without media queries, a big claim! So, just as we did with the prior method, we're going to run the example code through Email on Acid to see how it renders without any of our content in it, just the base example. It fares a little worse than the other structure with the main culprit being Outlook 2003. We do, however, have good mobile support. So if you find you have very low Outlook 2003 readership, this is definitely still a viable method for developing emails. So, what makes this method special? Rémi states in his post that this idea was born out of wanting to emulate flexbox behaviour in email. This is a fairly advanced technique, but I'll try and break it down into simple terms. The Fab Four technique relies on 4 different CSS properties working in tandem to control the widths, aka The Fab Four (in CSS):- calc()
- width
- min-width
- max-width