2009-08-13 15 views
2

我有一個三行,一列的網站設計,我想要調整中心內容div來適應列的其餘部分(高度屏幕 - (硬編碼footerheight +硬編碼頭高度))。有沒有一種可愛的方式來做到這一點與CSS?如果沒有,我怎麼才能用javascript做到這一點?根據用戶的顯示器的大小/分辨率動態調整div的高度

感謝,

湯姆

#container { 
    background-color: gray; 
    height: 100%; 
} 
#centercolumn { 
    background-color: white; 
    margin-left: auto; 
    margin-right: auto; 
    width: 800px; 
    height: 100%; 
} 
#header { 
    background-color: blue; 
    height: 150px; 
} 
#content { 
    background-color: yellow; 
} 
#footer { 
    height: 50px; 
    background-color: blue; 
} 

<html> 
    <head> 
    <link rel="stylesheet" href="test.css" type="text/css" media="screen"/> 
    </head> 
    <body> 
    <div id="container"> 
     <div id="centercolumn"> 
     <div id="header"> 
      header 
     </div> 
     <div id="content"> 
      content 
     </div> 
     <div id="footer"> 
      footer 
     </div> 
     </div> 
    </div> 
    </body> 
</html> 

回答

相關問題