Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.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 自动拉伸div,当它';s的默认高度/宽度已填充_Html_Css_Stretching - Fatal编程技术网

Html 自动拉伸div,当它';s的默认高度/宽度已填充

Html 自动拉伸div,当它';s的默认高度/宽度已填充,html,css,stretching,Html,Css,Stretching,我的模板如下: .layout{ height:100%; width: 70%; position: fixed; } .header{ height:20%; width: 100%; } .content{ height:60%; width: 100%; } .footer{ height:20%; width: 100%; } 内容有一个默认高度60%,我想知道如果内容填充了数据,在必要时自动拉伸(高度/宽度),整个页面会出现一个滚动条,怎么做 我尝试了给父母

我的模板如下:

.layout{

height:100%;
width: 70%;
position: fixed;

}

.header{

height:20%;
width: 100%;

}

.content{

height:60%;
width: 100%;

}

.footer{

height:20%;
width: 100%;

}

内容有一个默认高度60%,我想知道如果内容填充了数据,在必要时自动拉伸(高度/宽度),整个页面会出现一个滚动条,怎么做


我尝试了给父母的解决方案:相对但如果内容的数据较小,则会忽略默认高度并最小化内容,如果数据较小,则我希望保留默认高度。

如Motoxer4533所示,使用最小高度属性:

只需将
设置为
高度,并使用
最小高度
属性:

.content{
   min-height:60%;
}
这将
.content
的最小高度设置为60%,如果内容的数据占比超过60%,它将自动拉伸。
但你需要放下位置:固定在布局上。如果您的内容是动态的,则不需要此选项。

您是否尝试过最小高度声明?如果需要,是否要1/垂直滚动,如果不需要,页脚应该已经位于视口底部,内容从页眉一直延伸到页脚,或者如果需要,2/水平滚动,但没有垂直滚动?我需要两个垂直滚动和或水平(如果需要)。最小高度将固定默认高度,但对于拉伸,我需要相对高度,对吗?没有其他的拉伸解决方案?拉伸到底意味着什么?我的JSFIDLE中缺少了什么?通过为内容提供
minheight
overflow:scroll
to the parents如何将水平滚动也添加到content div?是的,当然,但我想我最好在另一个问题中发布:)如何将水平滚动也添加到content div?