100% height image not filling table cell

Firstly, accept my apologies for my code, I'm a html newbie.

I'm working on an email that has a cell with a rule at the top and text underneath. The next cell contains an image that's 1px deep, which I want to fill the height of the cell, which is in turn dictated by how much text there is in the previous cell.

Here's the code:

<table cellspacing="0" cellpadding="0" border="0" align="center" valign="top">
<td width="597px" height="100%" align="left" valign="top" bgcolor="red">
<hr color="#8384b4" />This text varies in length

<td bgcolor="white" width="36px" height="100%" valign="top" align="right"><img style="display: block" border="0" src="images/body_right.jpg" width="10" height="100%" alt=""/>

At the moment only Yahoo! mail and Apple mail are actually expanding the image to 100% of the cell height, neither Hotmail or Gmail are playing ball.

Any help is much appreciated.

radial radial, 6 years ago

Hi Peter

Just a quick note on HTML best practise in emails, these lines

<td width="597px" ...
<td bgcolor="white" width="36px" ...

should not have the "px" in the width as some email clients don't like this on tables.

With regards to the email I'm not sure that the way you have it is the best approach, I believe that height on cells is just not supported on many clients. Apple mail is one of the best so that will tend to display more CSS properties than any others (Gmail and Outlook tend to be the worst).

Maybe try using a background image in the table instead that is larger than you need to see and specifying


for that cell? This post should help with that http://www.campaignmonitor.com/blog/post/3170/adding-background-images-to-your-email-in-two-simple-steps/

This post will also help with regard to CSS support in emails for all the clients...

Hope this helps :)

I'm an experienced web and graphic designer with a love for great email marketing content and I'm an active supporter of the Email Standards Project. I'm the founder of Heliomail.com which I use to generate revenue for, and add value to, our current web & e-commerce clients at StudioWorks.eu

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free