如何在页面顶部保留导航栏? [英] how do I keep a nav bar at the top of the page?
本文介绍了如何在页面顶部保留导航栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让我的导航栏保持在页面顶部,就像在 forbes.com
I'm trying to make my nav bar stay at the top of the page like on forbes.com
我知道我可以做到
nav
{
position: fixed;
top: 0;
}
但是导航栏不在页面顶部,它位于徽标之后...但是当您向下滚动时,我希望导航栏粘在屏幕顶部..
but the nav bar isn't at the top of the page, it comes after the logo... When you scroll down however, I want the nav bar to stick to the top of the screen..
推荐答案
解决方案很简单,在添加 px 的同时保留 css
the solution is easy, keep your css while adding px
nav
{
position: fixed;
top: 0px;
}
这篇关于如何在页面顶部保留导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文