我想让我的页面内容始终显示在导航栏下方,类似于此页面的工作方式:
http://www.google.com/intl/en/enterprise/apps/business/products.html#calendar
您可以在内容中向下或向上滚动,但导航栏永远不会消失。
为此,我习惯position:fixed
将导航栏固定在页面顶部。这可行,但是当我希望内容始终被推到导航栏下方时,我仍然可以上下滚动内容,使其“通过”并越过导航栏。
关于如何做到这一点的任何想法?<ul id='navigation'>
这是包含导航的我的CSS代码:
#navigation
{
text-align: center;
position: fixed;
float: left;
margin: 0;
padding: 0;
top: 0;
left: 0;
list-style-type: none;
}
#navigation li
{
display: inline-block;
width: 150px;
height: 110px;
cursor: pointer;
}
<div id="container">
这是下面显示#navigation
并包含所有页面内容主体的 css :
#container
{
position: absolute;
margin-top: 180px;
font-size: 25px;
width: 90%;
}