CSS: make overflow-x: hidden truly hidden?

后端 未结 5 1714
-上瘾入骨i
-上瘾入骨i 2020-12-20 13:24

I have a div that is styled with overflow-x: hidden, but I\'m finding that when there is a wider div inside it that contains text, the user can still drag sidew

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-20 13:47

    I'm not sure if you need the y-axis of the inner div to be scrollable, but if you don't then this should suit your needs:

    #outer { 
        width: 150px; 
        height: 300px;
        overflow-x: hidden;
        border: 1px solid black;
    }
    #inner { 
        overflow: hidden;
        width: 100%;
    }​
    

    It appears as though overflow and overflow-x behave differently from each other. http://jsfiddle.net/G3T9w/5/

提交回复
热议问题