Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In outlook html email, float does not work

I want this layout where I have a rectangular box. And inside the box on the left there is a text and on the right there is an image. This looks fine in the browser, but when sent out as an html email, in outlook the float right doesn't seem to work. It puts the image in the next line under the text. Any ideas on how to make this work? (I am trying to avoid using tables.)

<div style="width: 100%;border-style:solid;overflow: hidden;">      <span style="float: left;">            <h3> Your appointment Details</h3>     </span>      <span style="float: right;">         <img src="someImage"/>     </span>  </div> 
like image 432
Foo Avatar asked Mar 12 '13 17:03

Foo


People also ask

Does float work in Outlook?

Outlook 2007 and 2010 does not recognise floats on images (along with a whole lot of other stuff).

Why does Outlook mess up HTML?

especially for supporting Outlook. Most Outlook versions don't support the box model or things like flexbox, CSS Grid, and floats. This lack of CSS support makes it hard to use semantic HTML to build email layouts that display properly in Outlook.

Why does my HTML email look different in Outlook?

Outlook sometimes skews HTML emails because all versions since Outlook 2007 use Microsoft Word to render HTML/CSS. Because of this, an email display may look slightly off in newer versions of Outlook from what you initially design and preview in Klaviyo.


2 Answers

Very late to the conversation, but here is how to "float" in html email using align="" instead.

Example here

Also, if you are looking for resources on html email (I assume you are as the answer you marked correct is very general), here is a huge list of resources.

like image 200
John Avatar answered Oct 11 '22 12:10

John


This is a really good guide from Mail Chimp on Coding for HTML Emails:

http://kb.mailchimp.com/article/how-to-code-html-emails

Some basic tips:

  • Use tables for layout.
  • Set your widest table to be maximum of 600px wide.
  • Don't try and use JavaScript or Flash
  • Don't use CSS in a style tag as some mail clients will discard it.
  • Use inline CSS styles only.

Basically code your emails as if it was roughly 2003.

like image 31
Billy Moat Avatar answered Oct 11 '22 12:10

Billy Moat