...

View Full Version : Making the DIVs in a 3 column layout to be the same height



CaptainB
08-08-2007, 11:34 AM
Hi guys!

I just thought about this, and I can't find out how I would archive it?

I have a 3 column layout with header and footer. I use the first DIV for my menu, middle DIV as my main window (where I write all the text etc) and the last one for nothing. But when I write text that's really long in the middle div , the div will of course expand further down beyond the 2 other divs. How would I make the 2 other divs automaticly follow the one in the middle?

abduraooft
08-08-2007, 11:54 AM
I recommend you to have a look at

http://bonrouge.com/3c-hf-fixed.php (http://bonrouge.com/3c-hf-fixed.php)
http://bonrouge.com/3c-hf-fluid.php

and try to adopt one of them!

Jutlander
08-08-2007, 01:36 PM
Like many others I have some basic templates, this is my 3 column if that's of any use.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>3 columns with header &amp; footer layout</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
body {
margin-bottom: 40px;
}
#wrapper {
margin: 0 auto;
margin-top: 15px;
width: 900px;
border: 1px solid #777;
color: #444;
background: #fff;
}
#header {
border-bottom: 1px solid #777;
padding: 1em;
background: #ddd;
}
#left {
float: left;
width: 170px;
padding: 1em;
}
#right {
float: right;
width: 170px;
padding: 1em;
}
#content {
margin-left: 200px;
margin-right: 200px;
border-left: 1px solid #777;
border-right: 1px solid #777;
padding: 15px;
}
#content p {
margin-bottom: 20px;
}
#content h2 {
margin: 0 0 .5em 0;
}
#footer {
clear: both;
border-top: 1px solid #777;
text-align: center;
padding: 10px;
background: #ddd;
}
</style>
</head>

<body>

<div id="wrapper">

<div id="header"><h1>Header</h1></div>

<div id="left">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<div id="right">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<div id="content">

<h2>Content header</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.</p>

</div>

<div id="footer"><p>Lorem ipsum dolor sit amet</p></div>

</div>

</body>
</html>

littlemiss
08-08-2007, 01:43 PM
in your div's css it might fix it if you include position:relative; top:0; then it should line up.

CaptainB
08-09-2007, 04:58 PM
It didn't work with that CSS. However I fiddled a little with Jutlanders code and found out, that the way to archieve would be to "cheat the look". So, I made my #container div the same color as the divs in the two sides, and now it works :thumbsup:

Jutlander
08-09-2007, 07:31 PM
Faking a height (for example) is an action I do quite often, when making layouts. It would be a lot easier if IE supported the min-height, min-width, max-height and max-width properties and didn't stretch something with a set height.

Let's hope the IE team will pull themselves together and rewrite the Trident engine. Let's face it, if it can be written, it can also be rewritten and modified. On the W3C website they say that the IE team is very active to meetings and that they actually work hard on making it better (will find he link if I can find it) - well we can't really use that if we don't see some improvements can we? :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum