Hi all! I’m trying hard not to use tables, but can’t figure out how to do this w/ box modeling. I would like a div that is auto hight so that it stretches to accommodate the contents. Inside that div I need 3 divs, left column (auto height), right column (auto height), and a divider in the middle which is like a middle column. That middle divider needs to be 100% height of the parent div so that it stretches w/ it. Kind of like a table, you know.
I can’t figure out how to do this. Everything I find on google tells me that for a div to be 100% height, height needs to be specified, either in percent or pixels on the parent div and all the way up to body/html. But I can’t have that, the parent div needs to stretch and can’t have a minimum height.
Here’s my mini-example code. As you can see the middle/divider column’s got a non-existant height.
[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>Test Div Stretch</title>
<style type=”text/css”>
#clearBoth {clear: both; visibility: hidden;}
.container {border: 1px blue solid;}
.col { float:left; border: 1px solid red; width: 300px;}
.divider { width: 3px; height: 100%; background: green;}
</style>
</head>
<body>
<div class=”container”>
<div id=”leftCol” class=”col”>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</div>
<div id=”midCol” class=”col divider”></div>
<div id=”rightCol” class=”col”>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed</div>
<div id=”clearBoth”></div>
</div>
</body>
</html>
I’m almost ready to resort to tables. ?
Any ideas?
Thanks!