html - 如何在页面顶部保留导航栏?

标签 html css navigation fixed

我正试图让我的导航栏像在 forbes.com 上一样停留在页面顶部

我知道我能做到

nav
{
   position: fixed;
   top: 0;
}

但是导航栏不在页面顶部,它位于 Logo 之后...但是当您向下滚动时,我希望导航栏保持在屏幕顶部..

This is my site

最佳答案

解决方案很简单,在添加 px 的同时保留你的 css

nav
{
   position: fixed;
   top: 0px;
}

关于html - 如何在页面顶部保留导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14390979/

相关文章:

html - 如何让基于 CSS <li> 的导航栏居中?

jquery - Pikachoose/Fancybox 集成 - 灯箱上的导航箭头

响应窗口大小的 jquery 可调整大小的栏

html - Firefox 在 div 中向右呈现表格,但在 IE 和 Chrome 中看起来正常

javascript - 使用 jQuery 打开关闭按钮

javascript - 当 child 在 CSS 中获得焦点时如何更改父样式

javascript - 如何每 30 秒自动更改一次下拉选项

javascript - 在 Google map 上绘制文字

html - Safari/Windows 中的 CSS *仅*,可能与溢出有关

html - 类似于 <ul> 的 nth-child(even)