开发者

Adding overflow-y to block element causes width to decrease.

开发者 https://www.devze.com 2023-04-07 01:02 出处:网络
This is what I have, I have left div, and a right div.The left div is a fixed width, and floated left.The right Div is a \"display: block\" to make it full width, and has a margin on the left to compe

This is what I have, I have left div, and a right div. The left div is a fixed width, and floated left. The right Div is a "display: block" to make it full width, and has a margin on the left to compensate for the left div. Both of the boxes have a fixed height, and need to be 开发者_Python百科scrollable (the contents inside). I add an overflow-y to the Left div successfully. However when I add overflow-y: auto to the right div, the div no longer spans the whole div.

Before adding Overflow: http://jsbin.com/asecuy/

After adding Overflow: http://jsbin.com/asecuy/2


You need to unset

.eventdetails {
    margin-left: 252px;
}

This margin is causing the bug. I'm guessing it just doesn't play nice together with overflow-y and the float next to it (should work though I think).

Here it is working:

http://jsbin.com/asecuy/3/#html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号