幽灵资源网 Design By www.bzswh.com

复制代码代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>CSS定义一个固定在页面顶部的层</title>
<style type="text/css">
body {
height:1200px;
margin: 0;
padding: 0;
background-attachment: fixed; /* prevent screen flash in IE6 */
}
div,ul{margin: 0;padding: 0;}
#topNavWrapper {
width: 980px;
text-align: left;
height: 31px;
margin: 0px auto;
z-index:100;
_position: relative ;
_top:0px;
}
#topNav {
width: 980px;
float: left;
display: block;
z-index: 100;
overflow: visible;
position: fixed;
top: 0px; /* position fixed for IE6 */
_position: absolute;
_top: expression(documentElement.scrollTop + "px");
background-image: url( /uploadfile/2012/0717/0717014456145_4456.gif);
background-repeat: no-repeat;
background-position: right;
height: 31px;
line-height: 31px;
color:#fff;
background-color:#444;
text-align:center;
}
</style>
</head>
<body>
<div id="topNavWrapper">
<ul class="jd_menu" id="topNav">
我是固定在页面顶部的层
</ul>
</div>
</body>
</html>
标签:
css,固定顶部,层

幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com