Forum Moderators: not2easy

Message Too Old, No Replies

Why there is no standard way for making a div height 100% of parent?ٌ

         

Aidin Sabetian

12:57 pm on Sep 24, 2005 (gmt 0)

10+ Year Member



There's no doubt that semantic tableless design, using DIVs and CSS is the easiest and the most convenient way for the box model.
Is there any reason why W3C provided no standard way for making a DIV stretch to the full height of it's parent DIV?

createErrorMsg

1:40 pm on Sep 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



no standard way for making a DIV stretch to the full height of it's parent DIV?

What's wrong with height:100%;? ;)

I assume you're dealing with a situation that is slightly more complex than just making a regular div stretch to 100% of it's regular parent.

Post some code and we'll get you straight.

cEM

Aidin Sabetian

2:27 pm on Sep 24, 2005 (gmt 0)

10+ Year Member




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Sabetian</title>
<style type="text/css">
#leftColumn, #center, #rightColumn {
float:left;
height:100%;
}
#leftColumn, #rightColumn {
width:150px;
background:yellow;
}
</style>
</head>
<body>
<div id="container">

<div id="leftColumn">leftColumn<br />leftColumn<br />leftColumn</div>
<div id="center">
center<br />
center<br />
center<br />
center<br />
center<br />
center<br />
center<br />
center<br />
center<br />
</div>
<div id="rightColumn">right<br />right<br />right<br />right<br />right<br />right<br />right</div>

</div>
</body>
</html>

The container stretches to the height of the longest child div, I want all of the child DIVs to stretch to the full height of the container.
I know about the faux columns trick but I want to achieve that layout w/o using any picture.

Aidin Sabetian