ironhide1975
Programmer
How do you get a CSS to tell a DIV to expand to the bottom of the page or expand as text is needed vertically.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
onload="getElementById('DIV2').style.height=getElementById('DIV1').style.height.value;"
<html>
<head>
<script>
function setheight() {
document.getElementById('DIV2').style.height=document.getElementById('DIV1').offsetHeight + "px";
}
</script>
</head>
<body onload="setheight();">
<div id="DIV1" style="width:40%; float:left; border-style:solid;">DSFsdfsdf sdfs df sdf sdf sdfsdf sdfsdfsdf<br />
sdf fsdfsdfsdf<br />
dsfsdf<br />
sdf<br />
sdf<br />
sd<br />
fsd<br />
fsd<br />
f<br />
sdf<br />
sd<br />
fsd<br />
</div>
<div id="DIV2" style="width:40%; float:left; border-style:solid;">DSFsdfsdf sdfs df sdf sdf sdfsdf sdfsdfsdf<br />
sdf fsdfsdfsdf
</div>
</body>
</html>
I would also point out that the 'faux column method' , makes the div stretch to the lenght of the page, not make 2 divs same in length dependent on one columns dynamic content
they did - lolWho said anything about that being the page?
The cheat
The embarassingly simple secret is to use a vertically tiled background image to create the illusion of colored columns. For SimpleBits, my background image looks something like Figure 2 (proportions changed for demonstration), with a decorative stripey thing on the left, a wide white section for the content column, a 1 pixel border, and a light brown section for the right column’s background followed by the reverse of the left side’s decorative border.
Figure 2
The whole image is no more than a few pixels tall, but when vertically tiled, it creates the colored columns that will flow all the way down to the bottom of the page — regardless of the length of content in the columns.