【发布时间】:2013-03-13 05:39:41
【问题描述】:
我在页面顶部固定了一个粘性标题。我希望它正常地粘在顶部,但在向下滚动时隐藏,就像 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 ;
}
【问题讨论】:
-
我不知道为什么用户删除了它,但答案就像一个魅力一样完美。谢谢!
-
我认为它没有解决您的问题。 XD
-
哪一个? css 还是 jquery?
-
太棒了!我刚刚注意到在我回答 jquery 之后你使用了
position:fixed;。 :(