2017-08-07 62 views
1

我试图在此电子邮件设计中使用以下媒体调用。很抱歉张贴了很多代码。当我达到660像素以下时,大标志消失,但较小的标志不出现在它的位置。徽标空间为空白。CSS媒体调用不起作用

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
     <title>Our Vineyard</title> 
     <style type="text/css"> 

      @media only screen and (max-width: 660px) { 
       table.container { width: 480px !important; } 
       td.logo img { display: none; } 
       td.logo { background: #c2ca19 url(../../My Site/Images/logo_medium.gif) no-repeat 10px 10px; height: 45px; } 
      } 

      @media only screen and (max-width: 510px) { 
       table.container { width: 100% !important; } 
       table.container td { border: none !important; } 
       td.logo { background: #2cca19 url(../../My Site/Images/logo_small.gif) no-repeat center 10px; height:32px; } 
      } 

     </style> 
    </head> 
    <body bgcolor = "#efe1b0" background="../../My Site/Images/banner_large.jpg"> 
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor = "#efe1b0"> 
     <tr> 
     <td> 
     <table class="container" width="640" align="center" border ="0" cellpadding="0" cellspacing="0"> 
     <tr> 
     <td valign="top" class ="logo" bgcolor="#ffffff" style="padding: 10px 20px 0px 30px; border-left: 1px solid #dbc064; border_right: 1px solid #dbc064; border_top: 1px solid #dbc064;"> 
     <a href ="#"><img style= "margin-left:-15px" src="../../My Site/Images/logo_large.gif" alt="Our Vineyard" width="585" height="45" border="0"></a> 
     </td> 
     </tr> 
     <tr> 
     <td colspan="2" valign="top" bgcolor="#ffffff" class="headline" style="padding: 15px 20px 5px 30px; border-left: 1px solid #dbc064; border-right: 1px solid #dbc064; font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 22px;"><h1 style="margin 0px 0px 15px 0px; font-weight: normal; font-size: 32px; color: #723c7F;">Main Heading Here</h1> 
     </td> 
     </tr> 
     <tr> 
     <td valign="top" bgcolor="#f5f2e5" class="banner" style="border-left: 1px solid #dbc064; border-right: 1px solid #dbc064;"> 
     <img src="../../My Site/Images/banner_large.jpg" width="638" height="180" alt="Photo of our Vineyard"></td> 
     </tr> 
+0

我最初认为这个问题是由于使用了不推荐的html属性。具体来说,我认为bgcolor可能会覆盖你的css规则。但我已经运行你的代码,并将图像改为lorem图像,一切似乎都正常工作。你确定要指定图片的正确位置吗? –

回答

2

您错过了添加视口meta,在您的脑海中添加meta元。

<meta name="viewport" content="width=device-width, initial-scale=1"> 

而且你应该有你的标准的CSS。

+0

谢谢。我把查看端口元,但它没有任何区别。我在哪里放标准的CSS?对不起,我的无知。 –

+0

尝试在媒体查询上添加标准css。 –

+0

你好RaJesh。如何在媒体查询上添加标准css。对不起,我对此很新。 –