Browsers scrollbar is under my fixed div

后端 未结 10 2256
抹茶落季
抹茶落季 2020-12-05 09:25

i have a fixed header with 100% width.

#header {
background: #2e2e2e;
width: 100%;
z-index: 999;
position: fixed;
}

browsers scrollbar is u

10条回答
  •  一个人的身影
    2020-12-05 09:52

    This can be solved by adding overflow of body

    from

    overflow:auto;
    

    to

    overflow:auto;
    overflow:initial;
    

    This is your issue

    If your scroll is set on body, if its structured as body > wrapper > header (with fixed position), content so on

    below is your solution

    solution for issue

    note: this will work only on body but not on div container with scroll. you can also work with z-index to get it to work, but you will be specifying z-index to stack other elements in order to get it right.

    Hope this helps..:)

提交回复
热议问题