自动拉伸div,当它的默认高度/宽度被填充 [英] Auto stretch div when it's default height/width is filled

查看:571
本文介绍了自动拉伸div,当它的默认高度/宽度被填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的范本如下:

.layout{

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

}

.header{

height:20%;
width: 100%;

}

.content{

height:60%;
width: 100%;

}

.footer{

height:20%;
width: 100%;

}

内容 strong>默认高度60%,并且如果内容填充,则需要自动伸展

the content has a default height 60%, and i want if the content is filled with data to get auto stretch for (height/width) when necessary, and a scroll appears for whole page, how to do so ?

我尝试了给予 <$>的解决方案。 c $ c> postion:relative; 但是会忽略默认高度,并且在内容具有小数据的情况下最小化内容,并且我想在小数据的情况下保持默认高度。 p>

i tried the solution for giving the parent postion:relative; but that will ignore the default height and minimize the content in case of the content has small data, and i want to keep default height in case of small data.

推荐答案

如Motoxer4533所示,使用min-height属性: http://jsfiddle.net/uef7v/

As indicated by Motoxer4533, use the min-height property: http://jsfiddle.net/uef7v/

这篇关于自动拉伸div,当它的默认高度/宽度被填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆