Suppose you have some style and the markup:
ul_x000D_
{_x000D_
white-space: nowrap;_x000D_
overflow-x: visible;_x000D_
overflow-y: hidden;_x000D_
/* added width so it would work in the snippet */_x000D_
width: 100px; _x000D_
}_x000D_
li_x000D_
{_x000D_
display: inline-block;_x000D_
}
_x000D_
<div>_x000D_
<ul>_x000D_
<li>1</li> <li>2</li> <li>3</li>_x000D_
<li>4</li> <li>5</li> <li>6</li>_x000D_
<li>7</li> <li>8</li> <li>9</li>_x000D_
<li>1</li> <li>2</li> <li>3</li>_x000D_
<li>4</li> <li>5</li> <li>6</li>_x000D_
<li>7</li> <li>8</li> <li>9</li>_x000D_
<li>1</li> <li>2</li> <li>3</li>_x000D_
<li>4</li> <li>5</li> <li>6</li>_x000D_
<li>7</li> <li>8</li> <li>9</li>_x000D_
</ul>_x000D_
</div>
_x000D_
When you view this. The <ul>
has a scroll bar at the bottom even though I've specified visible and hidden values for overflow x/y.
(observed on Chrome 11 and opera (?))
I'm guessing there must be some w3c spec or something telling this to happen but for the life of me I can't work out why.
UPDATE:- I found a way to acheive the same result by adding another element wrapped around the ul
. Check it out.
There is now a new way of addressing this issue - if you remove position: relative from the container which needs to have the overflow-y visible, you can have overflow-y visible and overflow-x hidden, and vice versa (have overflow-x visible and overflow-y hidden, just make sure the container with the visible property is not relatively positioned).
See this post from CSS Tricks for more details - it worked for me: https://css-tricks.com/popping-hidden-overflow/
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;
}
I used the content+wrapper
approach ... but I did something different than mentioned so far: I made sure that my wrapper's boundaries did NOT line up with the content's boundaries in the direction that I wanted to be visible.
Important NOTE: It was easy enough to get the content+wrapper, same-bounds
approach to work on one browser or another depending on various css combinations of position
, overflow-*
, etc ... but I never could use that approach to get them all correct (Edge, Chrome, Safari, ...).
But when I had something like:
<div id="hack_wrapper" // created solely for this purpose
style="position:absolute; width:100%; height:100%; overflow-x:hidden;">
<div id="content_wrapper"
style="position:absolute; width:100%; height:15%; overflow:visible;">
... content with too-much horizontal content ...
</div>
</div>
... all browsers were happy.
another cheap hack, which seems to do the trick:
style="padding-bottom: 250px; margin-bottom: -250px;"
on the element where the vertical overflow is getting cutoff, with 250
representing as many pixels as you need for your dropdown, etc.
I've run into this issue when trying to build a fixed positioned sidebar with both vertically scrollable content and nested absolute positioned children to be displayed outside sidebar boundaries.
My approach consisted of separately apply:
overflow: visible
property to the sidebar elementoverflow-y: auto
property to sidebar inner wrapperPlease check the example below or an online codepen.
html {_x000D_
min-height: 100%;_x000D_
}_x000D_
body {_x000D_
min-height: 100%;_x000D_
background: linear-gradient(to bottom, white, DarkGray 80%);_x000D_
margin: 0;_x000D_
padding: 0;_x000D_
}_x000D_
_x000D_
.sidebar {_x000D_
position: fixed;_x000D_
top: 0;_x000D_
right: 0;_x000D_
height: 100%;_x000D_
width: 200px;_x000D_
overflow: visible; /* Just apply overflow-x */_x000D_
background-color: DarkOrange;_x000D_
}_x000D_
_x000D_
.sidebarWrapper {_x000D_
padding: 10px;_x000D_
overflow-y: auto; /* Just apply overflow-y */_x000D_
height: 100%;_x000D_
width: 100%;_x000D_
}_x000D_
_x000D_
.element {_x000D_
position: absolute;_x000D_
top: 0;_x000D_
right: 100%;_x000D_
background-color: CornflowerBlue;_x000D_
padding: 10px;_x000D_
width: 200px;_x000D_
}
_x000D_
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>_x000D_
<div class="sidebar">_x000D_
<div class="sidebarWrapper">_x000D_
<div class="element">_x000D_
I'm a sidebar child element but I'm able to horizontally overflow its boundaries._x000D_
</div>_x000D_
<p>This is a 200px width container with optional vertical scroll.</p>_x000D_
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>_x000D_
</div>_x000D_
</div>
_x000D_
Source: Stackoverflow.com