Mastering Styled Alt Text in Email
Though it might seem like an afterthought to add alt text to images, it can make a huge difference for the success of your campaigns. Alt text is easy to style in many clients, and can help get your message across whether or not image blocking is on. I'll cover how to style your alt text, as well as some email client considerations.
Table of content
How to Style Alt Text
Styling alt text is actually very easy! We'll be using this image for our example. Images that have text in them with a message you really need to get across are the perfect place to use alt text. First, you'll need to add the alt text attribute to the image tag.<img src=".../image.jpg" width="300" height="300" alt="Get 30% off today!" />
This text can appear in a variety of different ways in the email, but by default it will take on the styles of its container. There are a few styles we should set for maximum readability.
<img src=".../image.jpg" width="300" height="300" alt="Get 30% off today!" style="font-size: 18px;line-height:20px;" />
Font size will help make sure that the alt-text doesn't get lost. Don't forget to set line-height, as many email clients will cut off the bottoms of letters if the line height is shorter than the font-size. Line-height can also be used to create spacing above and below the alt text.
Next we'll add a background color and font color, to mimic the color of the image.
<img src=".../image.jpg" width="300" height="300" alt="Get 30% off today!" style="font-size: 18px;line-height:20px;background-color:#987654;color:#ffffff;" />
Most email clients support background colors for blocked images, and this can really help maintain the look and feel of your email.
Finally, some centering. We can use text-align:center to make the text center within the image. Vertical centering is a bit harder. We can use line-height to center the text vertically. Our example image is 300px tall, so we'd set the line-height to 300px (assuming the text will all be on one line) to get it to center inside the image.
Where does alt text show?
Now that Gmail no longer blocks images, most clients will show images by default. However, many clients allow their users to choose whether or not to download images by default. They may opt to not download these images for security or to conserve mobile data. Note that Outlook desktop clients (2007-2016) will show the alt text you've added, but only after a long "security warning" message. They will not allow you to style the alt text at all. Outlook 2011 for Mac does allow you to style alt text.
Alt Text in Email |
||||
Email Client | Blocks Images by Default? | Alt text displayed? | Alt text can be styled? | |
---|---|---|---|---|
AOL | ✔ | ✔ | ✔ | |
Gmail | ✕ | ✔ | ✔ | |
Google Apps | ✕ | ✔ | ✔ | |
Yahoo! Mail | ✔ | ✔ | ✔ | |
Outlook.com | ✕ | ✔ | ✔ | |
Office 365 | ✕ | ✕ | ✕ | |
Apple Mail | ✕ | ✔ | ✔ | |
Lotus Notes 8.5 | ✔ | ✔ | ✕ | |
Outlook 2000-2016 | ✔ | ✔ | ✕ | |
Outlook 2011 (Mac) | ✔ | ✔ | ✔ | |
Thunderbird | ✕ | ✔ | ✔ | |
iOS Mail | ✕ | ✔ | ✔ | |
Gmail App | ✕ | ✔ | ✔ |