我有此电子邮件模板:
<!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>
。
如果我删除
width:100vw;
从…起
body
标签,桌面工作正常,但在移动版本中内容溢出。我的问题是,如何在移动设备上实现100%的机身宽度,在桌面上实现600像素的机身宽度?我试过了
max-width: 600px;
但它不起作用。我还尝试了100%而不是100vw(因为100vw是屏幕的宽度),但它也不起作用。