[英]CSS background doesn't stretch to the full height
我有一個高度為100%的元素。 如果有很多障礙,那么它們就會超越障礙。
jsfiddle示例: http : //jsfiddle.net/yPqKa/
如何解決?
提前致謝。
CSS:
html, body {
height: 100%;
width: 100%;
}
.content-background {
background-color: #000;
height: 100%;
width: 100%;
}
.content {
background-color: #eee;
height: 50px;
width: 100%;
margin-top: 60px;
}
問題是您已將html和body元素的高度設置為其容器的100%,這限制了它們小於它們所包含的元素。 如果除去height: 100%;
從第二行開始,它將起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.