我在页面顶部固定了一个粘性页眉。我希望它通常保持在顶部但在向下滚动时隐藏,就像 StackOverflow 中的顶部栏一样。我无法在其他类似的 SO 线程上找到解决方案。如果可能的话,我只需要一个 css/html 解决方案。 这是我为那个 div 编写的代码。
#topbar
{
background-color: #E6E6E6 ;
width: 100% ;
padding-left: 850px ;
padding-top: 3px ;
color: brown ;
top: 0px ;
left: 0px ;
position: fixed ;
height: 33px ;
}
最佳答案
改变自
position:fixed;
到
position:absolute;
关于html - 隐藏粘性标题栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15586034/