Reputation: 837
I've got a problem with overflow in a div nested inside another div which has display: table-cell style. I'm not sure why content from #left-wrapper is not cropped (hidden) when it exceeds height of #left-wrapper. Thanks in advance for any advices. Fiddle link: http://jsfiddle.net/bpbHY/1/
Here's my markup:
<div id="wrapper">
<div id="left">
<div id="left-wrapper">
<ul>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item</li>
<li>Menu item </li>
<ul>
</div>
</div>
<div id="center">Center content</div>
<div id="right">right</div>
</div>
CSS:
#wrapper {
display:table;
width:100%;
height:100%;
}
#wrapper > div {
display:table-cell;
height:100%;
}
#left {
width:70px;
min-width:80px;
height: 100%;
background-color:pink;
}
#left-wrapper {
overflow: hidden;
height: 100%;
}
#center {
background-color:green;
min-width:200px;
}
#right {
width:50px;
min-width:50px;
background-color:red;
}
li {
line-height: 80px;
}
body, html {
width:100%;
height:100%;
}
Upvotes: 0
Views: 9112
Reputation: 3283
I think this problem is occurring because of your use of display: table; and table-cell
I've taken the liberty of re-designing the CSS you have and I think this is what you're looking for:
Html stays the same and the CSS is as follows:
* {margin:0;padding:0;}
html, body{
height:100%;
width: 100%;
}
li {
line-height: 80px;
}
#wrapper{
width: 100%;
}
#left-wrapper {
background: pink;
width: 15%;
height: 100%;
float: left;
}
#left-wrapper ul {
height: 100%;
overflow: scroll;
background: pink;
}
#center {
background-color:green;
height: 100%;
width: 70%;
min-width:200px;
float: left;
}
#right {
width: 15%;
min-width:50px;
height: 100%;
background-color:red;
float: left;
}
Upvotes: 1
Reputation: 41832
The overflow: hidden
is not working because you are using display: table
and display: table-cell
. and also I used positioning to center the #center.
Here is the working fiddle
PS: I am using min-width: 200px
which you might want to change as your need.
Upvotes: 1
Reputation: 1305
After this, set listitems as overflow: scroll;
it should work.
Upvotes: 0
Reputation: 847
I am not sure , but maybe this will be useful for you:
li {
line-height: 80px;
overflow: hidden;
width: 100%;
height: 80px;
}
Upvotes: 0