gmail html 电子邮件背景颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9493922/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gmail html email background color
提问by Tomas Smith
IS there any way to put color as background in HTML email for gmail?
有没有办法将颜色作为 gmail 的 HTML 电子邮件的背景?
I used this for making body background grey but it doesnt work
我用它来使身体背景变灰,但它不起作用
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#e2e3e7" style="font-family:Arial, Helvetica, sans-serif;">
回答by digout
Wrap your email in a single celled table with 100% width and height and set the background colour for that cell.
将您的电子邮件包装在一个宽度和高度为 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>
回答by Mermoz
Gmail (and other mailers) remove all css that is not inlined. So the hack of the tables works only because you define the color inline. You don't need a table, instead use
Gmail(和其他邮件程序)删除所有未内联的 css。所以表格的hack 只因为你定义了内联颜色。你不需要一张桌子,而是使用
<body style="background-color:#242a30;">
回答by codesforcoffee
I just had to do the same thing. If you put your email body into a table, you can set the table's bgcolor and that will work.
我只需要做同样的事情。如果您将电子邮件正文放入表格中,则可以设置表格的 bgcolor,这将起作用。
I had <body bgcolor='lightcyan'>
, then I changed it to <body> <table bgcolor='lightcyan'>
and put my content into that table.
我有<body bgcolor='lightcyan'>
,然后我将其更改为<body> <table bgcolor='lightcyan'>
并将我的内容放入该表中。
回答by tiger-ente
in most cases you will have a centered email ... so do this an easy align="center" didnt work for me so i make a width="1680px"
在大多数情况下,你会有一个居中的电子邮件......所以这样做一个简单的 align="center" 对我不起作用所以我做了一个 width="1680px"
<table>
<tr>
<td width="1680px" align="center" valign="middle" bgcolor="#e4ebdd">
<table width='600' align='center' bgcolor='#ffffff'>
<!-- .... -->
</td>
</tr>