在做项目的时候,为了固定一个div,用到了position: fixed;属性。为了兼容IE7,请参考下面:
#top{
/*解决IE7不兼容问题,在IE7下会向右偏移*/
text-align: left;
}
.header{
border: 1px solid #000;
width: 100%;
height: 50px;
position: fixed;
background: #FFFFFF;
}
html代码:
<div id="top">
<div class="header"></div>
</div>