Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CSS { white-space: nowrap } with Outlook

I currently have a report with lots of wide columns that I am emailing directly out of SQL. I am generating the HTML for it dynamically but have come across an issue with column widths.

I have inserted the following CSS:

#tableMain 
TH { 
    text-align: center; 
    white-space: pre; 
    border: 1px solid black; 
    padding: 0; 
    border-spacing: 0; 
    border-collapse: collapse; 
    background-color: #f0f0f0; 
    font: 11pt bold arial sans-serif; 
} 

Now while the html generated this renders fine in IE, it insists on wrapping the cell contents onto two rows in Outlook.

In Internet explorer: As displayed in IE

In Outlook As displayed in Outlook

Outlook is our company wide email client so I don't need to support multiple clients, but I do need it to work nicely here.

And suggestions gratefully received.

like image 741
Matthew Baker Avatar asked Jun 25 '15 09:06

Matthew Baker


1 Answers

That fact is that Outlook uses Word (not IE) for rendering HTML markup of emails. All supported and unsupported HTML elements, attributes, and cascading style sheets properties you may find described in the following articles in MSDN:

  • Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
  • Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)
like image 55
Eugene Astafiev Avatar answered Sep 27 '22 16:09

Eugene Astafiev