css 固定顶部 怎么用css定义一个固定在页面顶部的

网站建设 2023-01-28 20:49www.1681989.com免费网站

复制代码
代码如下:

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

Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by