【发布时间】:2018-03-15 13:43:45
【问题描述】:
我有这个电子邮件模板:
<!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" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>title</title>
<style type="text/css">
img { max-width: 600px; -ms-interpolation-mode: bicubic;}
.ReadMsgBody { width: 100%; }
.ExternalClass {width:100%;}
.backgroundTable {margin:0 auto; padding:0; width:100%;!important;}
body {
width: 100%;
height: 100%;
direction: rtl;
}
.force-full-width {
width: 100% !important;
}
</style>
<style type="text/css" media="only screen and (max-width: 599px)">
@media only screen and (max-width: 599px) {
table[class*="w320"] {
width: 320px !important;
}
}
</style>
</head>
<body dir="rtl" class="body" style="width:100vw; padding:0; margin:0; display:block; background:#ffffff; -webkit-text-size-adjust:none" bgcolor="#ffffff">
<table align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" style="background-color:#ffffff" width="100%">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320">
<tr>
<td align="center" valign="top">
<table class="force-full-width" width="100%" cellspacing="0" cellpadding="20" bgcolor="#ef6900">
<tr>
<td style="background-color:#ef6900; color:#ffffff; font-size: 14px; text-align: center;">
Some text
</td>
</tr>
</table>
<!-- more tables -->
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>
它在 Android 中的 Gmail 应用上运行,但在桌面版电子邮件内容溢出 <u></u>。
如果我从body 标记中删除width:100vw;,桌面工作正常,但移动版本中的内容溢出。我的问题是如何在移动设备上将体宽设置为 100%,在桌面上设置为 600 像素?我尝试了max-width: 600px; 的身体风格,但它不起作用。我也尝试了 100% 而不是 100vw(因为 100 vw 是屏幕宽度),它也不起作用。
【问题讨论】:
标签: html css gmail html-email responsive