Gmail does not allow margin property

10,118

Solution 1

With HTML email you need to go back to the dark ages and use tables. Sad but true.

Rock Solid HTML Emails will help you.

Solution 2

Tables are the best things you can use for newsletters. Also remember that if are you using CSS it's better if you do it inline. In other words, like this:

<table style="margin: 0 0 15px 50px; color: #FFFFFF;"></table>

Do not have CSS in the header.

Solution 3

Yes @Alex is right when he says use in-line CSS. One thing though, No CSS shorthand is used: instead of using the abbreviated style rule margin:0 0 15px 50px use margin-top:0; margin-right:0; margin-bottom:15px; margin-left:50px;

Check http://www.sitepoint.com/code-html-email-newsletters/

Share:
10,118
Tushar Ahirrao
Author by

Tushar Ahirrao

I know Javascript, HTML5, CSS3, Java, PHP and more.... I enjoy building things, learning programming languages, listening to music.

Updated on June 04, 2022

Comments

  • Tushar Ahirrao
    Tushar Ahirrao almost 2 years

    I want apply margin property for my html newsletter

    But Gmail ignores this CSS property

    Is there any way to add margin to html element ?

    Thanks