在浏览器窗口(或电子邮件客户端预览窗格)中将HTML电子邮件内容居中的最佳方法是什么? [英] What's the best way to center your HTML email content in the browser window (or email client preview pane)?

查看:215
本文介绍了在浏览器窗口(或电子邮件客户端预览窗格)中将HTML电子邮件内容居中的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常将CSS规则用于 margin:0 auto 以及用于基于标准浏览器的内容的960容器,但是我是HTML电子邮件创建的新手,我现在想将以下设计放在没有标准CSS的浏览器窗口中。

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

我似乎还记得在某个地方,也可以通过将您的电子邮件表设计包装在设置为 width:100%并在正文上对 text-align:center 使用某种内联样式或类似的方法来做到这一点?

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?

是否有最佳实践?

推荐答案

将表格对准中心。

<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.

这篇关于在浏览器窗口(或电子邮件客户端预览窗格)中将HTML电子邮件内容居中的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆