css div固定顶部的方法

#header{
height:50px;
position: fixed;
top: 0;
width: 100%;
min-width: 600px;
z-index: 99999;
background:#fff url(images/menu.gif) repeat-x;
}

#container{
float: left;
width: 766px;
margin-top: 52px;
}

Html代码
<div id="head">

</div>

<div id="container">

</div>

此时顶部head可以固定,下面的div不会被顶部head遮住。

发表评论

邮箱地址不会被公开。 必填项已用*标注