set width of inner div on scrollable element to 100% of scrollable width

后端 未结 5 1078
小蘑菇
小蘑菇 2021-01-02 13:10

How do I get the width of this inner content div to be equal to the width of the scrollable area?

5条回答
  •  执念已碎
    2021-01-02 13:40

    You can't if you're going to set the outer div to be width 300px. It's the unbroken text breaking the bounding box. You can, however, wrap the word by adding this to the content CSS:

    word-wrap: break-word;
    

    However, if that 300px doesn't matter to you, you can move the overflow: auto from the scrollable class to the content one, and that, too, should fix the background issue.

提交回复
热议问题