Absolutely positioned div on right causing scrollbar when the left doesn't

后端 未结 11 640
被撕碎了的回忆
被撕碎了的回忆 2020-12-31 07:02

I\'m trying to \"flank\" a centered div with some design elements that are absolutely positioned outside the main div\'s width. I\'m getting a scroll bar due to the element

11条回答
  •  半阙折子戏
    2020-12-31 07:54

    If the page language is left-to-right, then the left non-fitting elements don't cause a scrollbar.

    Try this:

    ...
    

    This will change the text direction of the page to Right-To-Left, and now the left div will cause a scrollbar, not the right one.

    You can do the same with direction:rtl css property.

    If you want your page render to be independent from text direction then you can arrange page elements differently to avoid this.

提交回复
热议问题