-1

I am trying to put a form inside a mail from my website.

I just discovered that in Hotmail, float:left; and float:right; doesn’t seems to work, even in a HTML e-mail.

Is there any way to get around it?

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
matt_bois
  • 58
  • 1
  • 9
  • show your code or you will get -1s – Almis May 30 '14 at 02:28
  • should be easy to check with view source and something like firebug –  May 30 '14 at 02:29
  • if your sending to regular email clients you should be aware they support a very different set of html than a browser does –  May 30 '14 at 02:30
  • @Biox The fact the original poster is showing `float:left;` and `float:right;` is more than enough to explain the situation. Floats just don’t work well in HTML e-mails. Welcome to the world of nested ``s and inline CSS when you create HTML e-mails.
    – Giacomo1968 May 30 '14 at 02:41
  • Exactly. I told you guys that my e-mail has already all the necessary headers for a HTML e-mail. All I wanted to know is the reasons why some css doesnt work at all. ANd someone has answered profesionnaly +1 – matt_bois May 30 '14 at 15:22

1 Answers1

4

Is Hotmail blocking some CSS properties when send mail with PHP?

100% nothing to do with Hotmail specifically or PHP specifically, but the sad state of HTML e-mail design in general.

Hotmail & others will not use float values in CSS. In fact HTML e-mail is—in general—archaic and will force you to engage in design techniques that go all the way back to nested <table> layout practices of the 1990s. As explained on this page on “Email Design Guidelines” from Campaign Monitor; emphasis mine:

Before getting into the details, there are some uncomfortable facts that those new to HTML email should be aware of. Building an email is not like building for the web. While web browsers continue their onward march towards standards, many email clients have stubbornly stayed put. Some have even gone backwards. In 2007, Microsoft switched the Outlook rendering engine from Internet Explorer to Word. Yes, as in the word processor. Add to this the quirks of the major web-based email clients like Gmail and Outlook.com, sprinkle in a little Lotus Notes and you’ll soon realize how different the email game is.

Which is all to say if you think you can simply take HTML & CSS code from your main website to repurpose as a pure HTML e-mail you are in for a very rude awakening. The world of HTML e-mail design is a whole world of design headaches unto itself.

Another good resource on the topic can be found in “The Foundations of Coding HTML Email” from Litmus; again the emphasis is mine:

Simply put, many HTML and CSS properties used in modern web design are not supported in email. Email programs like Outlook 2007 and 2010 actually use Microsoft Word (yes, a word processor) to render HTML. In other words, building an email is not like building a website, unless you’re still building websites like we did back in 1999.

They even include this great—and head noddingly well structured—“Email Coding 101” graphic explaining what you need to know when designing HTML e-mails. Yes, it’s not pleasant but this is the sad reality of HTML e-mails in 2014.

enter image description here

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
  • 1
    +100 spent a few more hours than i would like on html email over the years. one of my bookmarked resources: http://msdn.microsoft.com/en-us/library/aa338201%28v=office.12%29.aspx –  May 30 '14 at 02:39
  • @Dagon Cool resource! Since I started creating websites in 1995, I just go back to ye olden days of… Geez, louise… It’s just horrible. – Giacomo1968 May 30 '14 at 02:42
  • 95 you just a noob :-) –  May 30 '14 at 03:06
  • @Dagon Does being on a Unix shell in 1992 & reading Usenet as well as learning about the WWW for the first time back then could? NCSA Mosaic. Nuff said. – Giacomo1968 May 30 '14 at 03:07
  • 1
    Wow! Thanks for all that explanation! This is more than I expected :) Thanks a lot!! – matt_bois May 30 '14 at 15:23