Ziil
Ziil

Reputation: 351

How to get rid of html table border in email template

I created email template in HTML, but it is not working as expected. To be precise then html table border part is not working in outlook. I have set border 0, but it is still appear in outlook email. If I run html in whatever editor then borders are not displayed.

I have googeled a lot and have tried different approaches, what I found, but non of those were helpful (different styles, border-collapse, set borders 0 on td and tr level etc).

Plain html look like this:

<table border="0" width="100%" cellspacing="0" cellpadding="0" 
align="center" bgcolor="#fff">
<tbody>
<tr bgcolor="#fff">
<td>Test</td>
<td>Test</td>
<td>Test</td>
<td>Test</td>
</tr>
</tbody>
</table>

Hopefully someone have faced similar problem and knows how to fix this.

Upvotes: 1

Views: 3313

Answers (3)

roye7777777
roye7777777

Reputation: 418

Anyone reading this in December 2021 and onwards: refrain from using border-collapse: collapse with padding. Since a recent Office 365 update, border-collapse: collapse causes emails to show gaps with the size of the stated padding as if they were margins. border="0" or border:0; is sufficient in most of the cases.

Upvotes: 2

user2958788
user2958788

Reputation:

Declare table { border-collapse:collapse !important; } in the head of your email.

There isn't any need to declare this on every single table.

Upvotes: 0

Alireza Sabahi
Alireza Sabahi

Reputation: 675

Try to use style="border: none"

<table border="0" width="100%" cellspacing="0" cellpadding="0" 
align="center" bgcolor="#fff" style="border: none">
<tbody>
<tr bgcolor="#fff">
<td>Test</td>
<td>Test</td>
<td>Test</td>
<td>Test</td>
</tr>
</tbody>
</table>

or using style = "border-collapse: collapse;"

<table border="0" width="100%" cellspacing="0" cellpadding="0" 
align="center" bgcolor="#fff" style = "border-collapse: collapse;">
<tbody>
<tr bgcolor="#fff">
<td>Test</td>
<td>Test</td>
<td>Test</td>
<td>Test</td>
</tr>
</tbody>
</table>

Upvotes: 2

Related Questions