
|
View Full Version : div wrapping, but not
OscarGuy 03-06-2009, 12:29 AM Here's my situation and I'm not sure how to fix it.
I have a "sort of" 3-column format. Basically, I have stuff in the left and stuff in the right. What I'm wanting to do is to have the center column wrap around the bottoms of the left and right menus when they come to an end. I'm fully expecting to have the body content go below the two columns. Right now, if I don't set margins on the main content div, it displays under the columns.
Is there a way to achieve my desired results or am I stuck with wide margins on each side even as the content goes below the menu divs on each side?
Christina 03-06-2009, 12:50 AM Would be easier to diagnose your specific problem if you provided an example of the code you're working with.
OscarGuy 03-06-2009, 01:13 AM I believe these are the relevant css segments.
#MainBody{
position: absolute;
float: left;
margin: 0px 0px 0px 181px;
padding: 0;
background-color: #e5e7e7;
border-bottom: 1px solid #a6a590;
text-align: left;
}
#Navigation{
position: relative;
float: left;
width: 180px;
padding: 0px;
background-color: #f5f7f7;
font: small Verdana,sans-serif;
border-right: 1px solid #a6a590;
border-top: 1px solid #a6a590;
}
#Updates{
position: relative;
float: right;
width: 180px;
background-color: #f5f7f7;
font: small Verdana,sans-serif;
border-left: 1px solid #d6d5c0;
border-top: 1px solid #a6a590;
}
tim2718281 03-06-2009, 07:18 PM Here's my situation and I'm not sure how to fix it.
I have a "sort of" 3-column format. Basically, I have stuff in the left and stuff in the right. What I'm wanting to do is to have the center column wrap around the bottoms of the left and right menus when they come to an end. I'm fully expecting to have the body content go below the two columns. Right now, if I don't set margins on the main content div, it displays under the columns.
Is there a way to achieve my desired results or am I stuck with wide margins on each side even as the content goes below the menu divs on each side?
This does what I think you want:
<!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-GB">
<head>
<title>Tim's three-column test page</title>
<style media="screen" type="text/css">
.col1 {width:20%; left:0%; float:left; position:relative;}
.col2 {position:relative;}
.col3 {width:20%; right:0%; float:right; position:relative;}
</style>
</head>
<body>
<div class="col1">
<h2>This is column one</h2>
<p>blah1 blah1 blah1 blah1 blah1 blah1 blah1 blah1 blah1</p>
</div>
<div class="col3">
<h2>This is column three</h2>
<p>blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3 blah3</p>
</div>
<div class="col2">
<h2>This is column two</h2>
<p>blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 blah2 </p>
</div>
</body>
</html>
OscarGuy 03-06-2009, 07:36 PM I have all of these within one main DIV.
But, I have tried setting the MainBody one relative, but it ends up at the top of the Main DIV element and the two relative single column ones display beneath the MainBody div and so it isn't 3 columns side by side.
tim2718281 03-06-2009, 07:56 PM I have all of these within one main DIV.
But, I have tried setting the MainBody one relative, but it ends up at the top of the Main DIV element and the two relative single column ones display beneath the MainBody div and so it isn't 3 columns side by side.
The code below worked for me.
I had to remove the background-color from MainBody because it was overwriting the other two columns.
(I changed the column width o percentages because the px values were giving confusing results on my system.)
#MainBody{
position: relative;
border-bottom: 1px solid #a6a590;
text-align: left;
}
#Navigation{
position: relative;
float: left;
width: 30%;
left:0%
padding: 0px;
background-color: #f5f7f7;
font: small Verdana,sans-serif;
border-right: 1px solid #a6a590;
border-top: 1px solid #a6a590;
}
#Updates{
position: relative;
float: right;
right: 0%;
width: 30%;
background-color: #f5f7f7;
font: small Verdana,sans-serif;
border-left: 1px solid #d6d5c0;
border-top: 1px solid #a6a590;
}
OscarGuy 03-06-2009, 09:28 PM That didn't work either. Still put the MainBody straight across the page and then after the MainBody tag closed, it put both the two columns.
tim2718281 03-07-2009, 04:38 AM OK, perhaps others could tell us what they see:
http://tim2718281.homelinux.com/threecolumn40.html
The appearance will vary according to the width of the browser window; but there should be a box at the top left headed "Navigation", a box at the top right headed "Updates", and the rest of the window should be filled with text headed "MainBody". The text under "MainBody" should fill the space between the two boxes; down the page it should flow under the left-hand box, and further down the page it should flow under the right-hand box.
OscarGuy 03-07-2009, 08:26 AM I don't see why yours worked and mine doesn't. What in my code is actually causing the problem?
tim2718281 03-07-2009, 10:35 AM I don't see why yours worked and mine doesn't. What in my code is actually causing the problem?
Well, post the code and we can try to see.
You need to post the css and the html, or give a link to a page with them.
OscarGuy 03-07-2009, 01:20 PM Links are in this thread:
http://www.webhostingtalk.com/showthread.php?t=763219
Though, I have it currently without positioning statements to prove a point of why I have to use them.
tim2718281 03-07-2009, 01:38 PM Links are in this thread:
http://www.webhostingtalk.com/showthread.php?t=763219
Though, I have it currently without positioning statements to prove a point of why I have to use them.
Sorry, that just comes out too garbled when I put it on my server. I can't actually read it because of the colours.
http://tim2718281.homelinux.com/oscar.html
I guess it needs more than the web page source and the style sheet.
Postscript:
Well, I went through the style sheet and removed all the color specs; so now I can read it:
http://tim2718281.homelinux.com/oscar01.html
Unfortunately, the width specifications are such that on my display, I only get a single column anyway.
|