Disable horizontal scrollbar due to a DIV with position:absolute which is outside of the page

后端 未结 7 2384
太阳男子
太阳男子 2020-12-28 13:59

I have an absolutely positioned element that is \"outside\" of the page, but I want browsers (I am using Firefox 3) not to display horizontal scrollbars. It seems that displ

相关标签:
7条回答
  • 2020-12-28 15:04

    Not too sure if this would help but you can try changing the styling for the mentioned divs to this instead:

    <div id="el1" style="position:fixed; left:-20px; top:0; background-color:yellow; z-index:-1">element</div>
    
    <div id="el2" style="position:fixed; left:20px; top:0; background-color:yellow; z-index:-1">element</div>
    

    By setting the position as fixed instead, it "locks" the specified divs in place while the rest of the content is still scrollable. Of course this is assuming that it is in the instance that the rest of the content is stacked by the z-index to be on top of the defined divs.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题