对网页中层的固定如何实现代码

夏夜,蟋蟀劲鸣,星光灿烂,月光清澈。孩提时的晨在小山上快活的玩味着每一朵花,每一株草,亦或躺在绿油油的草地数星星。一切都是那么的美好,那么的惬意。
对于DIV+CSS不熟悉的我,为此加班加点在项目上线时把问题解决了。参考代码如下:
复制代码
代码如下:

<!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="GBK"/>
<title>固定上下层的位置</title>
<style type="text/css">
<!--
body {
background-image: url(0);
background-attachment: fixed;
}
#BottomNav {
background: #9F6;
z-index: 999;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 30px;
position:fixed;
top: expression(documentElement.scrollTop + documentElement.clientHeight-this.offsetHeight);
overflow: visible;
}
#topNavWrapper {
height: 30px;
margin: 0px auto;
width:100%;
z-index:100;
position:fixed ;
top:0px;
left:0;
background: #9F6;
}
#center
{
width: 100%;
height:100%;
padding-top:30px;
padding-bottom:30px;
}
-->
</style>
</head>
<body>
<div id="topNavWrapper">固定悬浮导航在此处,不随滚动条的滚动变化</div>
<div id="center">
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
<p>我是中间层</p>
</div>
<div id="BottomNav">固定悬浮导航在此处,,不随滚动条的滚动变化</div>
</body>
</html>

以上就是对网页中层的固定如何实现代码。我的不幸,恰恰在于我缺乏拒绝的能力。我害怕一旦拒绝别人,便会在彼此心里留下永远无法愈合的裂痕。更多关于对网页中层的固定如何实现代码请关注haodaima.com其它相关文章!

您可能有感兴趣的文章
css让页脚保持在底部位置的四种方案

CSS如何使用Flex和Grid布局如何实现3D骰子

Flex布局史上最简单使用语法教程

新的CSS 伪类函数 :is() 和 :where()示例详解

纯CSS打字动画的如何实现示例