Spacers
Vertical spacing in HTML emails can be tricky, because of inconsistent support for margin, padding, and <br>
tags.
Here's how easy it is to create simple, yet reliable spacers for your emails, using basic HTML and Tailwind CSS utility classes.
Div
This is the simplest spacer you can use in an HTML email.
<div class="leading-64 sm:h-32">‌</div>
How it works:
leading-64
addsline-height: 64px;
- the default height, for desktop clientssm:h-32
setsheight: 32px;
for thesm
breakpoint - the responsive height- We use
‌
to add something inside, so it can take up height reliably in all email clients
Feel free to use
 
instead of ‌
, both work just fine.Row
Use this one directly inside a <table>
:
<tr>
<td class="h-64 sm:h-32"></td>
</tr>
Table
The Row spacer, but as a full <table>
.
<table class="w-full">
<tr>
<td class="h-64 sm:h-32"></td>
</tr>
</table>
Semantic
We can use an <hr>
to create a semantic Spacer.
<p>Paragraph about the weather</p>
<hr class="border-0 text-white my-64 min-h-full">
<p>Paragraph about my day at work</p>
How it works:
- we hide the line by resetting the border
- we give it the same color as the background of the page, for Outlook
- we define height with top and bottom margins
The min-h-full
class is used to get it working in Apple email clients.