Sharp, responsive images that render well on both mobile and desktop

Since pretty much all of today's mobile devices have high pixel density screens, you need to use "retina" images for your media to look sharp on any screen. This is done by using images that are usually twice (or even more!) the intended display size.

However, some email clients - specifically Outlook for desktop - don't like images that are larger than their container, and will blow up your design if you don't use a fixed width.

Acorn uses the fluid retina image technique, so that your images display well across the board, even in Outlook.


Fluid Retina Images

Not only does this ensure proper image sizing in all email clients, but your mobile images will not expand beyond their natural width.

Simply use the width="" attribute on an <img> tag, to set a fixed width that is half the natural image width. This is the intended display width, and will work in all email clients, including Outlook.

On mobile, Acorn will ensure your image scales proportionally and doesn't exceed its container width:

Note: the example is using a 400x400 image for retina, and a 200x200 one for non-retina. The difference is best viewed on a high-density display, like on a smartphone.

Mobile Full Width

Sometimes, you may need to have a retina image expand to 100% of its container width on mobile.

Since Acorn prevents this by default (through max-width: 100%;), you can use the full-width-sm utility class on the <img> tag, to force it to full width on mobile:

<img class="full-width-sm" src="..." alt="..." width="123">

Hiding Images on Desktop

While our hide-sm utility class is enough to hide an image in mobile email clients, things get a bit more complicated on desktop. You can hide images on desktop and only show them on mobile just like we do with the hamburger navigation icon:

The inline CSS and Outlook conditional comment will hide the image for desktop email clients, while the show-sm class will make it visible on mobile devices.