Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extra white space between tables in html email for gmail client

My code is at

http://jsfiddle.net/user1212/G86KE/4/

The problem is in gmail it leaves an extra white space between 2 tables inside the same cell. I have tried display:block; margin:0; padding:0; line-height:0;

However , it does not seem to go away.

enter image description here

Is there a fix to this?

like image 521
user544079 Avatar asked Jul 27 '12 14:07

user544079


People also ask

How do I add spacing in HTML email?

Using the <br> tag is the simplest way to add space in the email content when coded using HTML in email. This method can be used only to create spacing between the texts in the copy of an email and hence it is not used much. <br> tag can be used before and after the content.

Can I use padding in HTML email?

If you add margin or HTML email padding properties to your <table> element, it will add that same margin and padding to every nested <td> in Outlook 2007 and 2016. Cellpadding and cellspacing attributes are safe but it's best to avoid CSS margins and padding within the containing <table> element.

What is padding in an email?

Padding is referred to space within the border of an element. It represents the space in pixels, between the cell wall of the table data, <td>, and the content inside.


2 Answers

Using style="display:block" in the image tag should work. Also, don't forget to add it to the spacer image if you're using that.

like image 127
Hannah F Hudson Avatar answered Nov 15 '22 22:11

Hannah F Hudson


Styling HTML mails is horrible.

A few tips:

border-spacing:0; /*this should fix the spacing problem*/

You need to apply this to all the tables you are using, so you should include it in a <style> block at the top like so:

<head>
  <style>
    table {border-spacing: 0;}
  </style>
</head>

(sorry for the bad formatting, somehow the code refused to show up properly on multiple lines)

like image 28
Anders Arpi Avatar answered Nov 15 '22 23:11

Anders Arpi