CSS columns problem - faux columns don't work

H

henrybranson

I'm trying to achieve a multi-column layout in CSS where the columns
are all of equal length irrespective of the content in them. I've tried
to implement Dan Cederholm's faux columns solution but it doesn't work.

Here's my code - what am I doing wrong?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--

body {
color: #7F7F7F;
font: normal 0.70em/1.6em Verdana, Arial, sans-serif;
margin: 0;
padding: 0;
}

#container {
background: #fff56b url("bg.gif") repeat-y 0 0;
float: left;
width: 780px;
background-color: #FFF;
border: 1px dotted #000;
}
#column1, #column2, #column3, #column4 {
width: 25%;
background-color: #CCFFCC;
float: left;
}

#clear {
clear:both;
}
-->
</style>
</head>
<body>
<div id="container">
<div id="column1">content</div>
<div id="column2">Alternatively, if borders or padding can be avoided
altogether by just using margins instead, then the the Box Model Hack
will not be necessary. And if the column's content is simply sitting
(transparently) on top of the tiled background, then it should be easy
to avoid the hack.
</div>
<div id="column3">content</div>
<div id="column4">Alternatively, if borders or padding can be avoided
altogether by just using margins instead, then the the Box Model Hack
will not be necessary. And if the column's content is simply sitting
(transparently) on top of the tiled background, then it should be easy
to avoid the hack. Alternatively, if borders or padding can be avoided
altogether by just using margins instead, then the the Box Model Hack
will not be necessary. And if the column's content is simply sitting
(transparently) on top of the tiled background, then it should be easy
to avoid the hack.
</div>
<div id="clear"></div>
</div>
</body>
</html>
 
D

dorayme

From: (e-mail address removed)
I'm trying to achieve a multi-column layout in CSS where the columns
are all of equal length irrespective of the content in them. I've tried
to implement Dan Cederholm's faux columns solution but it doesn't work.

Here's my code - what am I doing wrong?

I had a fiddle and changing the width to just less than 25% for
the cols made them behave better, seems borders are taking up
space not leaving room for your specs... or you can have no
borders and no padding and leave your specs (looks awful but...)

Why don't you stop messing about and use a goddamn table and be
done. I didn't mean that. It just came all blurting out from the
subconscious. One really must restrain oneself in church...
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
I'm trying to achieve a multi-column layout in CSS where the columns
are all of equal length irrespective of the content in them. I've tried
to implement Dan Cederholm's faux columns solution but it doesn't work.

Here's my code - what am I doing wrong?

Nothing. That's the way css works. Your "length" is really height and
no parent height is established. Furthermore, the height you want is
not a parent.
 
J

Jim Higson

I'm trying to achieve a multi-column layout in CSS where the columns
are all of equal length irrespective of the content in them. I've tried
to implement Dan Cederholm's faux columns solution but it doesn't work.

Here's my code - what am I doing wrong?

If it isn't important that it works everywhere, Firefox 1.5 can do columns
with CSS3-like rules, and the final version should be out very soon.

see http://weblogs.mozillazine.org/roc/archives/2005/03/gecko_18_for_we.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top