DIV溢出覆盖

时间:2013-02-26 14:09:14

标签: html css

有人可以告诉我如何在

中制作我的内容
`#content-text`

在内容不适合时显示y轴滚动。目前它遵循body元素中的隐藏标记。谢谢!

body,html{
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    padding: 0;
    margin: 0;
    border: 0;
    z-index: 100;
    font-size: 100%;
}

#content-bg {

    padding: 2em;
    background-color: #362720;
    position: absolute;
    width: 33%;
    right: 3.3%;
    bottom: 6.4em;
    cursor: default;
    opacity: .7;
    z-index: 3;
    min-height: 20%;
    overflow:auto !important;
    overflow-style:auto !important;

}

#content-text {

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.7em;
    color: #FFF;
    z-index: 4;
    font-weight: lighter;
    overflow:auto !important;
    overflow-style:auto !important;
}

2 个答案:

答案 0 :(得分:0)

将高度或最大高度值设置为#content-text,然后设置

overflow-y:auto; overflow-x:hidden;

答案 1 :(得分:0)

#content-bg {
    padding: 2em;
    background-color: #362720;
    position: absolute;
    width: 33%;
    right: 3.3%;
    bottom: 6.4em;
    cursor: default;
    opacity: .7;
    z-index: 3;
    min-height: 20%;
    overflow-y:auto;
    overflow-x:hidden
}