twitter bootstrap - CSS背景颜色包装(由错误引起)



我遇到了一个有趣的问题。我的结构是

body
|----site-wrapper
       |-----cover-wrapper

高度设置为100%,当我设置site-wrapper的背景色时,它看起来很好,但是当我设置cover-wrapper背景色时,它只包装背景色以适合内容(一些文本),而不是扩展到整个屏幕,我在Chrome和Firefox上都尝试过。查看这里的效果:http://jsfiddle.net/h82Ne/

下面是css:

html{
    height: 200%
}
body {
    height: 100%;
    background-color: #333;
}
.site-wrapper {
    display: table;
    width: 100%;
    height: 50%; /* For at least Firefox */
    min-height: 50%;
    background-color: #000;
}
.cover-wrapper {
    display: table;
    width: 100%;
    height: 100%; /* For at least Firefox */
    min-height: 100%;
    background-color: #0f0;
}

如果你想让.cover-wrapper覆盖整个页面,你可以使用:

.cover-wrapper {
    width: 100%;
    height: 100%; /* For at least Firefox */
    position: absolute;
    top: 0;
    bottom: 0;
    background-color: #0f0;
}

这将使它的行为更像一个覆盖

问题解决了,这是我自己的错误,我在这里错过了site-wrapper-inner的css

抱歉

最新更新