...

View Full Version : Can you use Margin in HTML Emails?



treeleaf20
09-13-2011, 02:15 PM
All,
I know that I can't use the margin CSS in HTML messages because they aren't read by Gmail or Hotmail etc. Is there any kind of alternative to using Margin to position an image? Thanks in advance

VIPStephan
09-13-2011, 02:18 PM
As far as I know you can use inline CSS in HTML e-mails. Just write <img src="…" alt="…" style="margin-left: 20px">. If that doesn’t work then, of course, the alternative is using tables or a transparent spacer image.

treeleaf20
09-13-2011, 02:25 PM
I tried to control it both with a div and that didn't work and then I tried to do it with this code:



<img src="http://website.com/newsletters/place/images/logoWatermark2.gif" height="150" width="150" style="position:absolute; margin-top:90px; margin-left:130px;">


However this still doesn't work again.

alykins
09-13-2011, 02:52 PM
i seem to remember helping someone with an email "template" a while back and they couldn't get margins to work either... I ended up suggesting he make tables via empty table cells without borders and what-not as VIP was eluding to

treeleaf20
09-13-2011, 03:02 PM
Yeah, I can't really do that since they want the image to basically overlap the corners of four different cells. Sounds like the image just has to get moved...

VIPStephan
09-13-2011, 04:11 PM
[…] then I tried to do it with this code:



<img src="http://website.com/newsletters/place/images/logoWatermark2.gif" height="150" width="150" style="position:absolute; margin-top:90px; margin-left:130px;">


However this still doesn't work again.

Well, yeah, this wouldn’t work in any regular browser, too, since absolutely positioned elements’ margins have no effect on the rest of the page.

treeleaf20
09-13-2011, 04:14 PM
I don't want any of the other elements on the page to be affected. I only wanted the image to be affected. The other elements are in a table so I don't want them changed. I'm trying to overlay the image so that is why I was doing it that way.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum