(HTML) Margin bottom for tables?

10,786

The way you were using margin was incorrect. Margin has to be inside of a style attribute. The other attributes are table specific attributes that usually can only be used directly on tables. You can use margin, but if I were you, I'd use the <br/> tag because that will always be rendered the same way by all devices. Margin can be a bit iffy with some email systems like Outlook.

<table width="600" style="margin-bottom:50px;" cellpadding=8 cellspacing=0 border=0>
  //contents of table
</table>

<table width="600" cellpadding="0" cellspacing="0" border="0">
  //contents of next table
</table>

Share:
10,786
Windbrand123
Author by

Windbrand123

Updated on June 04, 2022

Comments

  • Windbrand123
    Windbrand123 almost 2 years

    I'm making an HTML email and the program that loads these do not accept separate CSS file, so everything has to be inline. For some reason margins for tables are not working. All I need is a gap between the bottom of a table and the next one.

    What I have so far:

    <table width="600" margin-bottom="50" cellpadding=8 cellspacing=0 border=0>
      //contents of table
    </table>
    
    <table width="600" cellpadding="0" cellspacing="0" border="0">
      //contents of next table
    </table>

    There is no gap created at all.

    This works:

    <table width="600" cellpadding=8 cellspacing=0 border=0>
      //contents of table
    </table>
    
    <br>
    
    <table width="600" cellpadding="0" cellspacing="0" border="0">
      //contents of next table
    </table>

    I also tried padding-bottom, doesn't do anything either.

    Is using <br> the only way then? Seems kind of awkward.

    • Windbrand123
      Windbrand123 over 6 years
      That is completely unrelated to my question. I'm already using inline styling (literally first sentence of my question) and using tables.
  • sd4ksb
    sd4ksb about 2 years
    This solution is not working on outlook email client and i have been searching and trying to find other ways aside from break tag.