Shaun Mccran

My digital playground

01
J
U
L
2009

Gmail Stripping styles out of html elements in emails

A recently 'feature' that has been added to Google is the way they are handling un styled elements.

In the last few weeks Gmail has started stripping the paragraph margins from its HTML emails. Basically is destroys the spacing from P tags, so that instead of being new lines, they are more like line breaks.

Checking the element in firebug shows that:

view plain print about
1.X0uMP p { margin:0;}

If you disable the style, then the html reverts to back to what you probably thought it should look like.

I'm guessing that as Gmail hasn't found an associated style with the element (P) it is applying its own.

You could change all the inline P's:

view plain print about
1<p style="margin-bottom: 8px;">

But that's hassle and not best practice really. I'll apply a CSS fix to it, and see if Gmail accepts that.

view plain print about
1p{margin-bottom:8px;}

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Back to top