CSS使底部容器高度达到可视空间的100%

CSS使底部容器高度达到可视空间的100%,css,html,height,Css,Html,Height,如何使div id蓝色占据容器div之后剩余的可见空间。此外,此div应该没有内容。使用此CSS: /*add this:*/ html, body { height: 100%; } .clear {clear:both; display:block; overflow:hidden; visibility:hidden; width:0; height:0; } #blue {width:100%; background:blue; /*and this*/height:100%

如何使div id蓝色占据容器div之后剩余的可见空间。此外,此div应该没有内容。

使用此CSS:

/*add this:*/
html, body
{
    height: 100%;
}

.clear
{clear:both;
display:block;
overflow:hidden;
visibility:hidden;
width:0;
height:0;

}
#blue
{width:100%;
background:blue;
/*and this*/height:100%;
}

为了让浏览器检测到您想要将蓝色div 100%展开,您必须告诉HTML和页面的正文也要100%,否则div没有参考百分比的内容

希望它能帮助您。

使用此CSS:

/*add this:*/
html, body
{
    height: 100%;
}

.clear
{clear:both;
display:block;
overflow:hidden;
visibility:hidden;
width:0;
height:0;

}
#blue
{width:100%;
background:blue;
/*and this*/height:100%;
}

为了让浏览器检测到您想要将蓝色div 100%展开,您必须告诉HTML和页面的正文也要100%,否则div没有参考百分比的内容

希望对您有所帮助。

将css更改为:

#container{margin-left:auto;margin-right:auto;width:200px;}

html,body { height:100%; }

.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0;}

#blue{width:100%;background:blue;height:100%;}
您还必须扩展页面的高度。

将css更改为:

#container{margin-left:auto;margin-right:auto;width:200px;}

html,body { height:100%; }

.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0;}

#blue{width:100%;background:blue;height:100%;}

您还必须延长页面的高度。

类似的内容

像这样的

像hobby.ellisberner.com/contact.html这样的东西怎么样?你是指背景吗?像hobby.ellisberner.com/contact.html这样的东西怎么样?你是指背景吗?