变形的IE问题高度100%

时间:2011-03-01 23:23:18

标签: html css internet-explorer

我正在尝试在Internet Explorer的视口中将高度设置为100%。如您所想,以下代码适用于其他任何地方:

* {
    margin: 0;
    padding: 0;
} 

html, body {
    height: 100%;
}

body {
 font-family: Times New Roman, Times, serif;
 font-size: 13px; 
 background-color:#E8E8E8;
 background:url(/images/background.png) repeat-x;
}

#wrap {
 margin:0 auto;
 width: 935px; /*  Change to desired width :)  */
 min-height: 100%;
 background:url(/images/content.png)repeat-y;
}

#main {
    overflow: auto;
    padding-bottom: 112px;
}  /* must be same height as the footer */

1 个答案:

答案 0 :(得分:0)

我假设你有这个HTML结构:

<html>
  <body>
    <div id="wrap"></div>
  </body>
</html>

如果是这样,将min-height添加到wrap div:

#wrap
{
   min-height: 100%;
}

请注意,此技术不适用于较旧的IE(当它完全停止在IE7下工作时我不确定)并且它有一个不可预测的问题,Opera对如何解释height和{{有自己的看法1}}说明。