嵌套的div滚动条

ker*_*nic 6 html css

我试图让内部div显示y轴滚动条而不是外部div.

在示例中,外部div是滚动,其中包括我不想要的菜单.

http://jsfiddle.net/TKDqT/6/

CSS

div#container
{
        overflow: auto;

        width: 90%;
        height: 65%;
        position: absolute;
        top: 100px;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0 auto -10px;
        padding: 10px;

        background-color: rgba(0,0,0,0.6);
        border:0px solid black;
        border-radius:15px;

        font-family: 'PT Sans', arial, serif;
        color:#ffffff;
        text-align:right;
        font-size:18px;
}

div#content
{
        font-family: 'PT Sans', arial, serif;
        color:#ffffff;
        text-align:left;
        font-size:14px;
}
Run Code Online (Sandbox Code Playgroud)

ced*_*d-b 12

您必须设置overflow:autoon on div#contenton div#container并以某种方式指定div#content类似的高度height:95%

这是一个小提琴:http://jsfiddle.net/TKDqT/9/

或者你也可以用jQuery指定高度:

$("div#content").outerHeight( $("div#container").innerHeight() -  $("div#content").position().top);
Run Code Online (Sandbox Code Playgroud)

这比高度百分比更准确.