Add a clear:both to your right column. To manage the height of having a float at the bottom of your main content area use a clearfix. Also, since you want the right column to float underneath the left column, there's no need to float the left column?
+1
A:
apphacker
2009-05-05 14:09:17
Thx for the answer apphacker, but normally I would like to display the right pane on the right of the content. (only on small screens I would like the alternate layout) The clear:both does not enable that.
GvS
2009-05-05 14:22:04
The only way to do that is to use JavaScript.
apphacker
2009-05-06 02:43:23
+1
A:
Here's a variety of CSS layouts that should do exactly what you want:
You're probably looking for #4 under the fixed or fluid layouts.
Chris Doggett
2009-05-05 14:20:51
+2
A:
This will allow your right, fixed-width column to fit in the margin of your other column, and therefore be on the same line:
#right
{
float:right;
width:18em;
}
#body
{
margin-right: 20em; //IE calculates padding into the width, so you need a buffer unless you set body's padding to 0
}
Now the body's div, which defaults to 100% screen width, will be fluid, and your right column will be fixed width.
Zack
2009-05-05 14:25:14
A:
Try this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Пример</title>
<style type="text/css">
html,body{
margin:0;
padding:0;
}
#header{
height:150px;
min-width:600px;
background:#FFEF97
}
#menu{
width:250px;
float:right;
background:#FFC597
}
#info{
min-width:350px;
background: red;
}
#footer{
height:20px;
min-width:600px;
background:#B9CC8A;
clear:both
}
#body{
width: expression(((document.documentElement.clientWidth
|| document.body.clientWidth) < 600)?
"600px" : "100%")
}
</style>
</head>
<body>
<div id="body">
<div id="header">HEADER</div>
<div id="menu">MENU (side bar)</div>
<div id="info">INFO (central pane)</div>
<div id="footer">FOOTER</div>
</div>
</body>
</html>
Roman
2009-05-05 14:37:10
wouldn't `#body { min-width: 600px; }` work instead of mixing javascript with your CSS?
Zack
2009-05-05 19:31:35
No, expressions are nessecary to fix ie6 problem (ie6 doesn't support min-width and max-width)
Roman
2009-05-05 21:15:45
web expressions are bad ok. The browser executes the javascript everytime you resize the browser, change anything at all, look at it wrong. And they don't work in IE 8. And what are you doing setting the width of the body element? Use a container.
apphacker
2009-05-06 02:44:59
`#container {min-width: 600px;}` should work, then just wrap your elements in `<div id="container"></div>`
S Pangborn
2009-10-16 15:19:00
A:
Not tested (yet), but I think I have found the solution to the problem.
http://www.alistapart.com/articles/holygrail/
This solutions allows to mix fixed and liquid layout (terms I learned from asking this question).
GvS
2009-05-15 12:55:30