626*_*626 2 html css email gmail html-email
我在使用Gmail时遇到了一些CSS问题.我的HTML电子邮件具有响应能力,可以在iPhone上运行,但在发送到Gmail时,它会显示"mobile_toolbar"和"full_toolbar".我需要摆脱移动工具栏,以便为Gmail桌面正确格式化电子邮件.
我已经尝试过使用display:none!important但它无效.
谢谢!
CSS:
<style type="text/css">
.ReadMsgBody {width: 100%; background-color: #ffffff;}
.ExternalClass {width: 100%; background-color: #ffffff;}
body {width: 100%; background-color: #ffffff; margin:0; padding:0; -webkit-font-smoothing: antialiased;font-family:Arial}
table {border-collapse: collapse;}
p {font-family: Arial, serif;}
a {font-family: Arial, serif;}
@media only screen and (max-width: 640px) {
body[yahoo] .deviceWidth {width:440px!important; padding:0;}
body[yahoo] .center {text-align: center!important;}
#full_toolbar {display:none !important;}
#mobile_toolbar {display:block; background:white;}
#mobile_toolbar a {text-decoration:none;}
}
@media only screen and (max-width: 479px) {
body[yahoo] .deviceWidth {width:280px!important; padding:0;}
body[yahoo] .center {text-align: center!important;}
}
@media screen and (min-width: 641px) and (max-width: 1920px) {
*[id=mobile_toolbar] {
display:none!important;
overflow:hidden!important;
}
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="full_toolbar"><img usemap="#toolbar" class="deviceWidth" src="images/main_toolbar.jpg" alt="" style="display: block; border-radius: 4px;" border="0">
Run Code Online (Sandbox Code Playgroud)
<div id="mobile_toolbar" >
<a href="#"><div style="margin-bottom: 5px; width:100%; height:100%; color:black; background:#a4a4a4; font-weight: bold;">New Inventory</div>
<a href="#"><div style="margin-bottom: 5px; width:100%; color:black; background:#a4a4a4; font-weight: bold;">Used Inventory</div>
<a href="#"><div style="margin-bottom: 5px; width:100%; color:black; background:#a4a4a4; font-weight: bold;">Services</div>
<a href="#"><div style="margin-bottom: 5px; width:100%; color:black; background:#a4a4a4; font-weight: bold;">Directions</div>
<a href="#"><div style="margin-bottom: 5px; width:100%; color:black; background:#a4a4a4; font-weight: bold;">Contact</div>
<a href="#"><img src="images/twitter.jpg"></a> <a href="#"><img src="images/facebook.jpg"> </a><a href="#"><img src="images/youtube.jpg"></a> <a href="#"><img src="images/google.jpg"></a>
</div>
Run Code Online (Sandbox Code Playgroud)
Gmail仅接受内联样式.没有头标签,没有样式标签,只有内联.这意味着没有媒体查询.
这应该给你你需要的答案.:)
这也是一个很好的帮助:http://www.campaignmonitor.com/css/