最近在准备写一个html的邮件模板,在网上搜了下资料,而后用express结合reload搭建了一个环境,结合本身开发中遇到的一些坑,总结一下。html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HTML Email编写指南</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="/js/reload.js"></script>
</head>
复制代码
<body
style="margin: 0; padding: 0;font-family: 'Microsoft YaHei', '微软雅黑', sans-serif; "
>
</body>
复制代码
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background:#FAFAFA" >
</table>
复制代码
<td style="width: 108px;height:80px; padding-left: 30px;padding-right: 20px;" >
<div style="font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;width: 108px;height:20px; color: #ffffff;line-height: 20px;font-size: 20px;font-weight: 700;" >
dssdssds
</div>
</td>
复制代码
<td style="height:80px;">
<div
style="font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;width: 54px;height:18px; color: #ffffff;line-height: 18px;text-align: center;font-size:12px;border: 1px solid #ffffff;border-radius: 2px;font-weight: 300;"
>
企业版
</div>
</td>
复制代码
在window的outlook office 365下会表现的td的宽度超多54px,达到100px左右,因此必须在td上加上宽度express
<td style="height:80px;width:54px;">
<div
style="font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;width: 54px;height:18px; color: #ffffff;line-height: 18px;text-align: center;font-size:12px;border: 1px solid #ffffff;border-radius: 2px;font-weight: 300;"
>
企业版
</div>
</td>
复制代码
<table>
<tr>
<table></table>
</tr>
<table></table>
</table>
复制代码
这种在mac的outlook和window的outlook的(office 365)下面都没有问题,可是在window的outlook(2016)下面整个外层的table也是居中,可是会把宽度拉的超级宽,只要加一层tr就能够解决这个问题。bash
<table>
<tr>
<table></table>
</tr>
<tr><table></table></tr>
</table>
复制代码