I normally use CSS rules for margin:0 auto
along with a 960 container for my standard browser based content, but I'm new to HTML email creation and I've got the following design that I'd like to now center in the browser window without standard CSS.
http://static.helpcurenow.org/mockups/emails/2010/may-survey/survey.html
I seem to recall seeing somewhere that it can also be accomplished by wrapping your email table design in an outer table set to width:100%
and using some inline style for text-align:center
on the tbody or something like this to do it?
Is there a best practice for this?
Try the following: Wrap your content in another table with style="table-layout: fixed;" and align=“center”. Why use a table for this if there's only going to be one row and one column?
To center text using HTML, you can use the <center> tag or use a CSS property.
You can do this by setting the display property to "flex." Then define the align-items and justify-content property to “center.” This will tell the browser to center the flex item (the div within the div) vertically and horizontally.
Align the table to center.
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> Your Content </td> </tr> </table>
Where you have "your content" if it is a table, set it to the desired width and you will have centred content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With