Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 高度:100%css不工作_Html_Css_Stylesheet - Fatal编程技术网

Html 高度:100%css不工作

Html 高度:100%css不工作,html,css,stylesheet,Html,Css,Stylesheet,我举了一个JFIDLE的例子,看起来我的身高是100%;它不起作用 body, html { height:100%; } #full-wrap { min-height:100%; height: auto !important; height:100%; margin:0 0 -91px; /* 1 extra px from footer border */ clear:both; border:thin solid

我举了一个JFIDLE的例子,看起来我的身高是100%;它不起作用

body, html 
{
    height:100%;    
}

#full-wrap {
    min-height:100%;
    height: auto !important;
    height:100%;
    margin:0 0 -91px;    /* 1 extra px from footer border */
    clear:both;
    border:thin solid red;
}
.contentCenter {
    min-height:100%;
    height:100%;
    width:300px;
    margin: 0 auto;
    clear:both;
    border:thin solid blue;

}


.footer {
    height:90px;width:100%;
    border-top:1px #E8E8E8 solid;
    clear:both;
}    


<div id='full-wrap'>
    <div class='contentCenter'>
    </div>
</div>
<div class='footer'>
</div>
body,html
{
身高:100%;
}
#全套{
最小高度:100%;
高度:自动!重要;
身高:100%;
边距:0 0-91px;从页脚边框额外增加1 px*/
明确:两者皆有;
边框:薄而实的红色;
}
.资源中心{
最小高度:100%;
身高:100%;
宽度:300px;
保证金:0自动;
明确:两者皆有;
边框:淡蓝色;
}
.页脚{
高度:90px;宽度:100%;
边框顶部:1px#E8E8E8实心;
明确:两者皆有;
}    
有人能帮我解决这个问题吗?正如您所看到的,边界线(蓝色)不是100%

height: auto !important;
拆下那条线,它就会工作


删除该行,它就会工作。

父级的高度
#full wrap
div设置为
height:auto
,您需要指定一个高度,以便子级div扩展100%,因此将其设置为100%或固定高度。请记住,基于百分比的高度是相对于其容器的。

父级
#full wrap
div的高度设置为
height:auto
,您需要指定一个高度以使子div扩展100%,因此将其设置为100%或固定高度。请记住,基于百分比的高度是相对于其容器的。

您的代码是正确的#全包取100%高度,但不是他的孩子您的代码是正确的#全包取100%高度,但不是他的孩子谢谢!快速提问。如果你能帮助我。我有另一个div,带float:left。我设置了一个左浮动,因为我需要在另一个div旁边,但我想知道是否可以设置高度:100%左浮动?谢谢nvm,明白了!非常感谢你!谢谢快速提问。如果你能帮助我。我有另一个div,带float:left。我设置了一个左浮动,因为我需要在另一个div旁边,但我想知道是否可以设置高度:100%左浮动?谢谢nvm,明白了!非常感谢你!