You want to specify both, CSS height
is not the same as min-height
. You want to specify both height
and min-height
.
height
= When used as a %
, this is a percent of the window height
min-height
= as you drag the window smaller, the DIV with a %
height
will continue to reduce until it hits the min-height
max-height
= as you drag the window larger, the DIV with a %
height
will continue to increase until it hits the max-height
http://jsfiddle.net/gpeKW/2/ I've added a sample here with borders.
Slight change to the answer from your comment, you are pretty much correct from your original CSS.
The below HTML will have a minimum div height of 100px. As the size of the inner DIV increases, the wrapper will automatically expand. I have demonstrated this by adding a style
attribute to the first inner class
.
<html>
<head>
<title>Untitled Page</title>
<style type="text/css">
.wrapper
{
background-color: #000;
min-height:100px;
}
.inner
{
display: inline-block;
background-color: #777;
height: 100%;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="inner" style="height:200px">test</div>
<div class="inner">Peace</div>
</div>
</body>
</html>