gmail html电子邮件背景颜色

Tom*_*ith 13 html email

有没有办法在gmail的HTML电子邮件中添加颜色作为背景?

我用它来制作身体背景灰色,但它不起作用

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#e2e3e7" style="font-family:Arial, Helvetica, sans-serif;">
Run Code Online (Sandbox Code Playgroud)

dig*_*out 21

将您的电子邮件包裹在100%宽度和高度的单个细胞桌中,并设置该单元格的背景颜色.

<table width="100%" height="100%">
    <tr>
        <td width="100%" height="100%" bgcolor="#e2e3e7">

            <!-- "Content" table goes here -->
            <table width="600" align="center" bgcolor="#ffffff">

            </table>

        </td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

  • 这很有用,但如果您希望它填充电子邮件窗口,您还必须将width ="100%"和height ="100%"添加到上面的<table>.所以<table width ="100%"height ="100%">. (2认同)

Mer*_*moz 11

Gmail(和其他邮件程序)会删除所有未内联的css.所以表的破解只是因为你定义了内联颜色.您不需要表,而是使用

<body style="background-color:#242a30;">
Run Code Online (Sandbox Code Playgroud)


小智 9

我只需要做同样的事情.如果您将电子邮件正文放入表格中,则可以设置表格的bgcolor,这样就可以了.

我有<body bgcolor='lightcyan'>,然后我把它更改为<body> <table bgcolor='lightcyan'>并将我的内容放入该表.