百分比div的滚动条

时间:2014-05-01 13:25:16

标签: css html height scrollbar percentage

我在主div中有两个div,其中一个div应该填充div中的剩余高度,并且应该使用滚动条来显示多余的内容。当我将div设置为百分比高度时,滚动条不起作用并显示所有内容。主div用于填充页面的大小。如果我将div设置为特定的像素高度,这是有效的,但这不是想要的。

html, body {
    background-color: #E6E6E6;
    max-height: 100%;
    max-width: 100%
}

#main {
    float: right;
    text-align: justify;
    top: 11%;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
    margin-top: 10px;
    max-width:auto;
    max-height: auto
}

#half {
    max-width: 40%;
    float: left;
    max-height: 40%;
    overflow-y: scroll
}

#second {
    position: relative;
    margin-left:10%;
    width: 40%;
    float: left;
    margin-right: 10%
}

0 个答案:

没有答案