Search code examples
htmlcssemailinline-code

Best inline style format for HTML email?


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>

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.