2015-06-12 85 views
3

我已經在我的網站寬度和高度一樣使用變化響應網站

<table width="800px" height="600px" border="0" cellspacing="0" cellpadding="0" class="leftborder"/> 

我不得不改變了響應,但它不工作我設置背景顏色爲紅色,當我重新大小我的瀏覽器的代碼媒體查詢其顯示顏色不僅沒有在調整大小內容

enter image description here

我的代碼:

<style type="text/css"> 

    @media only screen and (min-width: 320px) and (max-width : 780px) 
     { 
      .leftborder 
      { 
       background-color:skyblue; 
      } 


.rightborder { 
border-right: 1px solid #000000; 
} 

.leftborder { 
border-left: 1px solid #000000; 
border-right: 1px solid #000000; 
border-bottom: 1px solid #000000; 

border-style: thin; 
} 


.style2 {font-size: xx-small} 

.descriptor_row 
{ 
background:#003366; 
font-size:x-small; 
color:#FFFFFF; 
border:#FFFFFF; 
} 


BODY { font-family: Arial, Helvetica, sans-serif; 
    line-height:160%; 
    font-size:14px; 
    color:#000; 
    background: url(images/gradient2.jpg); 
    background-repeat: repeat-x; 
    background-color:#FFF; 
}  


table.leftborder{ 

    align:"right"; 
    width:800px ! Important; 
    height:600px ! Important; 

} 

      } 



/* MOBILE LANDSCAPE */ 
     @media only screen and (min-width: 480px) and (max-width: 780px) 
     { 
.leftborder  { 
       background-color:blue; 
      } 

} 



/* SMALL TABLET */ 
     @media only screen and (min-width: 600px) and (max-width:780px) 
     { 
      .leftborder 
      { 
       background-color:green; 
      } 

     } 



/* TABLET/NETBOOK */ 
     @media only screen and (min-width: 768px) and (max-width: 780px) 
     { 
      .leftborder 
      { 
       background-color:yellow; 
      } 

} 



.rightborder { 
border-right: 1px solid #000000; 
} 

.leftborder { 
border-left: 1px solid #000000; 
border-right: 1px solid #000000; 
border-bottom: 1px solid #000000; 

border-style: thin; 
} 


.style2 {font-size: xx-small} 

.descriptor_row 
{ 
background:#003366; 
font-size:x-small; 
color:#FFFFFF; 
border:#FFFFFF; 
} 


BODY { font-family: Arial, Helvetica, sans-serif; 
    line-height:160%; 
    font-size:14px; 
    color:#000; 
    background: url(images/gradient2.jpg); 
    background-repeat: repeat-x; 
    background-color:#FFF; 
}  




</style> 
<script type="text/javascript"> 
function openWindow(winName) 
{ 
    window.open(winName,"FAQs", "width=950,height=650,resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,copyhistory=no,left=100,top=100,screenX=100,location=no,screenY=100"); 
} 
</script> 
</head> 

<link href="style.css" rel="stylesheet" type="text/css"> 

<body bgcolor="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0"> 

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="design"/ > 
    <tr> 
     <td align="center"> 
     <table width="800px" height="600px" border="0" cellspacing="0" cellpadding="0" class="leftborder"/> 
       <tr bgcolor="#FFFFFF"> 

       <td colspan="2" style="background-image:url('site_conf/images/det_banner.jpg'); background-repeat:no-repeat; background-position:center;" width="100%" height="100" align="right" /> 

       <?php 
       if(!is_null($sid)&&$session_error=="none") 
       { 
        $_SESSION['lms_username']=$lms_username; 
        ?><TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="190" > 
        <TR> 
         <TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000">Logged in as: <B><?php echo $lms_username; ?></B></TD> 
        </TR> 
         <?php 
         if($lms_groups=="on" && $lms_user_group!=""){ 
         ?> 
         <TR> 
          <TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php echo"$lms_gtitle: "; if($lms_groups=="on"){echo"<B>$lms_user_group</B>";}?></TD>   
         </TR> 
         <TR> 
          <TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php echo "$lms_sgtitle: "; if($lms_groups=="on"){echo"<B>$lms_user_subgroup</B>";}?></TD> 

         </TR> 
         <tr> 
          <TD><FONT FACE="VERDANA" SIZE="1" COLOR="#000000"><?php if($section=="reports" && $report){echo"<A HREF='index.php?section=reports&sid=$sid'>Back to Detailed Reports Section";}?></FONT></TD> 
         </tr> 
         <?php }?> 

        </TABLE> 
        <?php 
       } 
       ?></td> 
       </tr> 
       <tr> 
        <td colspan="2" height="20" background="images/bg.gif"> 
         <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
          <td>&nbsp;</td> 
          <TD align="right"><?php 
       if(!is_null($sid)&&$session_error=="none") 
       { 
       ?><a style="" href="index.php?section=<?php echo $section; ?>&logout=YES&sid=<?php echo $sid; ?>"><img src="images/logout.gif" border="0" align="ABSMIDDLE" alt="Click here to Log Out"></a><?php 
       } 
       ?></TD> 
         </tr> 
        </table></td> 
       </tr> 
      <tr> 
       <?php 
       if(is_null($sid)||$session_error!="none") 
       { 
        $nav_display = 'display: none'; 
       } 
       ?> 
       <td valign="top" style=" <?php echo $nav_display; ?> "> 
       <!---------BEGIN SIDE NAV TABLE-------------> 
       <table width="198" border="0" cellspacing="0" cellpadding="0" > 
        <tr valign="top" bordercolor="#FFFFFF"> 
        <td width="198" bordercolor="#FFFFFF"><?php   
        if((!is_null($sid)&&$session_error=="none")) 
        { 
         include($dir_components."navbar2.php"); 

        } 
        ?></td> 
       </tr> 
       <tr><td>&nbsp;</td></tr> 
       <tr> 
       <td></td> 
      </tr> 
     </table> 
    </td> 
    <td class="boxcontent" VALIGN="TOP" > 
    <?php 

    include($mysection); 
    ?></td> 
    </tr> 
</table> 
</td> 
</tr> 
</table> 
<hr width="200;"> 
</body> 
</html> 

添加圖片我得到了什麼?請幫助我的任何建議?

+0

它不是可以說,不檢查你的代碼什麼,是否有可能加入你的代碼中http://jsfiddle.net/? –

+0

看看這個http://stackoverflow.com/questions/30742346/how-to-make-auto-adjusting-divs-that-are-pre-set/30743284#30743284 –

+0

k @RoySonasish wii add jsfiddle – Thennarasu

回答

0

在您的媒體查詢你只是改變了顏色,你應該如何得到響應式設計。您需要更改其他屬性,如widthheight以調整相應的屏幕大小。或者有適合你的其他選項,例如迴應表格插件,或者如果你想通過你需要媒體查詢來確定先決定如何在特定的屏幕尺寸想顯示選項類似於滾動表破錶頭成塊和以下的列等,那麼只有你去媒體查詢調整爲相應的。

+1

謝謝@ K.C我會改變我的寬度和高度後,分配媒體查詢謝謝 – Thennarasu