繁体   English   中英

滚动显示固定标题

[英]Scroll fixed header with content

我有一个我无法解决的任务。

我有一个Web内容,其中包含标题div,内容div和背景中的完整图像。 标头div的位置固定,我无法更改。

关键是,我必须编写css,这将允许我向上滚动标题和内容。 这是链接

我想要的是滚动内容的标题,但保持标题div位置固定。

body {
    background: #eee;
    font-family: sans-serif;
}

div.sidebar {
    padding: 10px;
    padding-bottom: 60px;
    border: 1px solid #ccc;
    background: #fff;
    top: 10px;
    left: 10px;
    bottom: 10px;
    width: 580px;
}
div#fixed {
    background: #76a7dc;
    padding-bottom: 10px;
    color: #fff;
    position: fixed;
    width: 580px;  
    height:50px;
    z-index: 1;
}

因此,当前您已在标题固定的位置进行设置,并且不随内容滚动。

如果我在正确地阅读您的内容,则此标头已经具有position的css属性:fixed并且您无法更改它,对吗?

要使其随内容滚动,您可以将overflow-y置于: 然后在侧边栏容器上,而不是.scrollable容器上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM