0

我有这个布局:

<div id="container">
<div id="sidebar">
    <div id="logo"></div>
    <div id="box"></div>
</div>
<div id="content">
    <div id="gallery">
        <div class="thumb"></div>
        <div class="thumb"></div>
        <div class="thumb"></div>
        <div class="thumb"></div>
        <div class="thumb"></div>
    </div>
</div>
</div>

这是CSS:

#container {
    background-color: black;
    display:block;
    position:absolute;
    height:auto;
    width:auto;
    bottom:0;
    top:0;
    left:0;
    right:0;
    overflow:hidden;
    background-size:auto 100%;
    margin:50px;
}
#sidebar {
    background-color: purple;
    min-width: 250px;
    width:250px;
    max-width: 20%;
    height:100%;
    overflow:hidden;
    float:left;
}
#logo {
    height: 100px;
    background-color: orange;
}
#box {
    bottom: 20px;
    font-family: sans-serif;
    font-size: 10px;
    color: grey;
    margin: 20px;
    padding: 10px;
    background-color: white;
    overflow-y: scroll;
    text-align: justify;
}
#content {
    display:inline;
    width:75%;
    margin-left: 300px;
    padding: 0px;
    margin:0px;
    text-align: center;
    background-color: green;
    overflow-y: scroll;
}
#gallery {
    margin-left: auto;
    margin-right: auto;
    display: table;
    background-color: blue;
}
.thumb {
    width: 200px;
    height: 150px;
    display: inline-block;
    background-color: black;
    margin: 20px;
    border: 7px solid white;
    overflow:hidden;
    background-color: yellow;
}

我需要#boxand 或者#galleryor的内容#content可以垂直滚动。

因为我的布局负责并且#container的溢出是隐藏的,所以我认为这些功能一定有问题。

这里我创建了一个jsFiddle来说明问题。

4

1 回答 1

0

您可以在 CSS #box 中添加它

max-height : 100px ; /*for example*/

编辑 :

因为你可以使用

overflow: auto;

在 DIV 你想滚动

于 2013-05-17T03:49:42.110 回答