Sub topic 8
Building buttons that survive every client
This chapter assumes you know the table layout from earlier chapters, inline CSS, and the basics of the box model. It covers how to build a call-to-action button that stays visible, colored, and easy to tap in any email client.
Why an image or a styled link is not enough
A web button is usually an <a> or <button> with a background, padding, and rounded corners. In email this breaks in several ways:
- Image buttons disappear when a client blocks images by default. The reader sees an empty box or only the alt text.
- Some clients strip
<button>and form elements. - Desktop Outlook uses the Word rendering engine. It often ignores padding on inline links, so the clickable area shrinks to the text.
- Clients that drop
<style>blocks lose any class-based button styling.
A "bulletproof" button puts the color on a table cell and the text in a real link, with every style inline. If CSS or images fail, the button still shows its color and a working link.
The basic pattern
<table role='presentation' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td bgcolor='#0b5fff' style='border-radius:6px;'>
<a href='https://example.com/order' style='display:inline-block;padding:14px 28px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:20px;font-weight:bold;color:#ffffff;text-decoration:none;'>View your order</a>
</td>
</tr>
</table>Each part has a job:
- The
bgcolorattribute sets the fill. Clients that ignorebackground-colorin CSS still honor the attribute. border-radiuson the cell rounds the corners. Clients without support show square corners, which is an acceptable fallback.- The link carries
display:inline-blockand padding, so the tappable area is the whole padded rectangle in clients that support it. - Font, size, weight, and color are inline on the link. Many clients restyle links with their own blue and underline unless you set
colorandtext-decorationon the<a>itself.
Making the whole button tappable
If a client ignores link padding, only the text is clickable. You can move the padding to the cell and keep the link as a plain text link:
<table role='presentation' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td bgcolor='#0b5fff' align='center' style='border-radius:6px;padding:14px 28px;'>
<a href='https://example.com/order' style='font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:20px;font-weight:bold;color:#ffffff;text-decoration:none;'>View your order</a>
</td>
</tr>
</table>This version colors the full rectangle in every client, but only the text is a link in clients that ignore link padding. The first version gives a larger tap area in clients that honor padding. Choose based on which clients matter to your audience, or use the first pattern with an Outlook-specific fallback (covered in the Outlook chapter).
Sizing for touch
Aim for a tap target of at least 44 by 44 pixels. With 16px type, a 20px line height, and 14px padding top and bottom, the button is 48px tall. Keep 8 to 16px of space between adjacent buttons so fingers do not hit the wrong one.
Common errors
- Writing the link color in a
<style>block only. Clients that strip it show default blue text on a blue button. - Using white text on a color you never checked for contrast. Aim for a ratio of at least 4.5:1.
- Writing vague link text such as "Click here". Use text that names the action, like "View your order".
- Relying on
width:100%for a full-width mobile button without a fallback. Set a fixed width in the markup and widen it in a media query where supported.
Exercise
A reader opens your email in a client that blocks images and ignores padding on inline links. Which of the two button patterns still shows a colored rectangle, and what is the trade-off?
Show answer
The second pattern, with padding on the table cell. The cell's background color fills the whole rectangle with no image. The trade-off is that only the link text is tappable, so the tap area can be smaller than the visible button.