我的粘性标题覆盖了垂直滚动条,有没有办法解决这个问题?
标题代码(使用 HTML5 标签)
header {
background: none repeat scroll 0 0 #283744;
border-bottom: 4px solid #4F5B66;
height: 97px;
margin-top: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 999;
}
最佳答案
是的,让该元素具有更高的 z-index,并确保您为该元素设置了定位,例如相对或其他定位。
header {
background: none repeat scroll 0 0 #283744;
border-bottom: 4px solid #4F5B66;
height: 97px;
margin-top: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 999;
}
底层元素
#underlyingelementwithscrolls{
position:relative;
z-index:1000;/*higher than 999 since header has it*/
}
在你的情况下,你已经覆盖了 body 滚动条 这样做它应该得到修复
body{
overflow:hidden;}
html{
overflow-y:scroll;}
关于css - 覆盖垂直滚动条的粘性标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231820/