Render Error: iOS layering images

This week a client brought an unusual rendering problem to the CALM team. In the iOS native Mail app the email was appearing very broken, with images and content layered and floating on top of each other. iOS is generally a very easy going email renderer, supporting a ton of modern CSS and standard HTML.  So when this issue was brought to our attention, it was baffling to say the least.

The email itself was very simple, basically a text preheader, a series of images stacked in tables stacked, and a footer. At the client’s request, we coded the images in the email without a defined height.  It is generally best practice to define a height for an image, however in this case, leaving the height to be computed enables the client to easily update the images at the last minute.

We dug into the problem right away. After ruling out a syntax error, things got interesting. After some troubleshooting, we discovered that iOS Mail in iOS 7-9 on the iPhone 5s and iPhone 6 when confronted with images without a defined height and no other elements to define their height loses its mind and tries to layer them on top of each other.

This is the simplest example we could contrive: two images in the body of an HTML document without a defined height. (The opacity is set so that we can see how iOS is layering the images.)


Cat's heads don't generally float over their feet.
Cat’s heads don’t generally float over their feet.

In this example, we’ve wrapped the two images in a container table and that seems to have solved the problem.


However, what happens if we split the two images into their own tables.


Everything appears fine, but if we add some text at the same level as the container tables, things break again.



The simplest and most reliable solution we settled on is to make just sure our content is wrapped in a container table. This is generally best practice anyway and perhaps why we’ve not seen this problem before.



We will keep exploring this error and will post any updates.  Please post a comment with any questions or solutions that you have found.

Read More