【问题标题】:Scrollbar moves fixed div滚动条移动固定 div
【发布时间】:2020-10-26 16:52:22
【问题描述】:

如果页面有滚动条,我有一个固定的导航栏,它可以正确定位自己。但是我的一些页面显示没有滚动条,然后导航栏跳到右边。

我的导航栏的 CSS:

header#masthead {
    position: fixed;
    width: 100%;
}

这使它在滚动条可见时起作用:

body{
  overflow: scroll;
}

尝试过没有成功,没有任何反应:

html {
  overflow-y: scroll;
}

My website

【问题讨论】:

    标签: scrollbar navbar fixed


    【解决方案1】:
    header#masthead {
        position: fixed;
        width: 100vw;
    }
    

    是解决方案!

    【讨论】:

      猜你喜欢
      • 2012-11-24
      • 2012-04-04
      • 1970-01-01
      • 2019-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多