【发布时间】:2014-06-09 14:27:50
【问题描述】:
我正在处理一封响应式 HTML 电子邮件。我所有的代码都是内联的,媒体查询除外。 (我知道这不适用于某些电子邮件客户端!)在媒体查询中,我定义了 2 个类:
@media only screen and (max-device-width: 480px), screen and (max-width: 550px) {
img[class="width320"] {
width: 320px !important;
}
img[class="autoHeight"] {
height:auto !important;
}
}
当我将它们添加到 HTML 中时 -
<tr>
<td width="700" class="" style="display: block;" border="0">
<img src="Welcome_WoodBottom.jpg" class="width320 autoHeight" height="26" width="700" border="0" alt="" style="display:block;" />
</td>
</tr>
这两种样式都不起作用。这些样式单独工作,但当它们在一起时则不行。当我在 Firebug 中检查代码时,“width320”和“autoHeight”类甚至没有出现在检查器中。
我错过了什么?由于某种原因,您不能在电子邮件媒体查询中使用多个类吗?
我真的很想在我的电子邮件的各个领域使用多个类,所以我希望有一个解决方案。提前非常感谢您!
【问题讨论】:
-
试试这个 img.width320{} 和 img.autoHeight{} 而不是 img[class="autoHeight"]{}
标签: css responsive-design media-queries html-email