Question

Which inline style format better for an HTML email template:

<table height="800"></table>
<table bgcolor="#000000"></table>

or

<table style="height:800px;"></table>
<table style="background:#000000;"></table>
Was it helpful?

Solution

height="800px" is invalid. You would want height="800" (no px in height attribute). The CSS version should work in many clients, but @John reports that there is not 100% compatibility with it.

By far the best thing to do with e-mails is to not set a height at all though, since it doesn't really work. Let your content flow.

OTHER TIPS

You can use both nowadays. However, if you want to be bullet proof use height="800" which works better for some older clients

the first one

<table height="800"></table>

height="800" works in all clients and is the way you should do it. height:800px; does not.

Same for background, the 100% supported method is bgcolor="#000000", but only in <table> or <td> elements.

You should always use the top examples if you expect to get consistency across email clients.

This rule also applies to align="left" (correct) vs text-align:left; or float:left;, and valign="top" also works where vertical-align:top; is useless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top