CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue

后端 未结 6 876
孤街浪徒
孤街浪徒 2020-11-21 06:27

Suppose you have some style and the markup:

6条回答
  •  一个人的身影
    2020-11-21 06:46

    I originally found a CSS way to bypass this when using the Cycle jQuery plugin. Cycle uses JavaScript to set my slide to overflow: hidden, so when setting my pictures to width: 100% the pictures would look vertically cut, and so I forced them to be visible with !important and to avoid showing the slide animation out of the box I set overflow: hidden to the container div of the slide. Hope it works for you.

    UPDATE - New Solution:

    Original problem -> http://jsfiddle.net/xMddf/1/ (Even if I use overflow-y: visible it becomes "auto" and actually "scroll".)

    #content {
        height: 100px;
        width: 200px;
        overflow-x: hidden;
        overflow-y: visible;
    }
    

    The new solution -> http://jsfiddle.net/xMddf/2/ (I found a workaround using a wrapper div to apply overflow-x and overflow-y to different DOM elements as James Khoury advised on the problem of combining visible and hidden to a single DOM element.)

    #wrapper {
        height: 100px;
        overflow-y: visible;
    }
    #content {
        width: 200px;
        overflow-x: hidden;
    }
    

提交回复
热议问题