Reputation: 21
I have an image in cell 1 of a 2 cell row. There is text in cell 2. Because Outlook.com decides to give extra spacing between text (compared to other browsers) it is distorting (adding height to) the whole row: but the image in cell 1 stays aligned to the top of the cell.
I have tried forcing the line height for the text, but that does not work.
Currently my code is:
<td style="vertical-align: middle;" valign="middle">
<p style="text-align: center;">
<img style="margin: 0 auto; vertical-align: middle;" valign="middle" title="Date and Venue" alt="Date and Venue" src="imgURL" height="x" width="y">
</p>
</td>
But all these instructions are ignored by Outlook.com.
How do I make the image center itself in the cell?
Upvotes: 2
Views: 7119
Reputation: 12193
Images should always have display:block;
in email. You don't need any of the margin or css align stuff. Here is a basic example for you:
<table width="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" height="100" align="center" valign="middle" bgcolor="#cccccc">
<img style="margin: 0; border: 0; padding: 0; display: block;" src="" width="50" height="50" alt="">
</td>
</tr>
</table>
Upvotes: 3