Forum Moderators: not2easy
I would like to be able to set the height for each column so it automatically matches the height of the longest column.
The reason I want to do this is because my left and right column contain a background design that I want continued no matter how long the centre content column is.
Any ideas?
When I try this it seems to be 100% of the body???
position:absolute; is position:relative; - you can still specify heights and widths, and the element is part of the normal flow of elements. This means that if the element is nested inside another, height:100%; should give your element a height of 100% of it's parent element, not 100% of the body. /* parent div */
#corners{
border: #000000 solid 1px;
background-color: #0000ff;
width: 100%
}
/* left column */
#cornersleft{
border: #000000 solid 1px;
background-color: #00ccff;
width: 180px;
height: 100%;
position: relative;
left: 0px
}
/* centre column */
#cornerscenter{
border: #000000 solid 1px;
background-color: #ffffff;
margin: 0px 180px 0px 180px;
height: 100%;
position: relative
}
/* right column */
#cornersright{
border: #000000 solid 1px;
background-color: #00ccff;
width: 180px;
height: 100%;
position: relative;
right: 0px
}
Have a look at this thread [webmasterworld.com] about 3-column layouts. There's more info in there than I can possibly give.
Does anyone know of any robust 3 column layouts (that will allow a header and footer) not using absolute positioning?
Theoretically, something like:
div#content {
margin: 0px 25% 0 25%;
}
div#left {
width: 25%;
float: left;
}
div#right {
width: 25%;
float: right;
} should work. Only Mozilla gets it right, however (with MSIE 6 and Opera 6 a close second and third). The fact of the matter is that CSS support is still spotty in the current generation of browsers, and there's no getting around that except hacks and sub-optimal use of CSS.
As for the original question, the only reliable way to set CSS height currently is by using absolute values (i.e., pixels), and then only on elements that have a position value of other than "static".