...

View Full Version : Problem with Sitelayout



OGGordon
12-20-2009, 05:31 PM
Hey guys,

I've been having some trouble with this layout, particularly the center section. Im not sure what I am doing wrong.

Here's what I have as index file:



<body>
<div id="top-wrap">
<div id="header">
<?php include("header.php"); ?>
<?php include("datetimeregion.php"); ?>
</div>
<div id="navwrap">
<div id="nav">
this is the nav
</div>
</div>
<div id="pathbar">
<?php include("path.inc.php"); ?>
</div>
<div id="datetimeregion">

</div>
</div>
<div id="wrap">
<div id="adspace">
this is google ad space
</div>
<div id="middle">
<div id="center">
this is the center
</div>
<div id="right">
this is the right
</div>
</div>
</div>
<div id="footer">
this is the footer
</div>
</body>
</html>


and here is what I wrote in the style.css file




*{ margin:0 auto; padding:0; }

body { background-color:#F3F6F2; }

#top-wrap { width:100%; }
#midwrap { width: 960px; height: 43px; }

#header { width:960px; height: 110px; background-color:ffffff; }
#logo1 { width: 200px; float: left; }
#search { width: 180px; float: left; padding-left: 20px; }

#adspace { width: 960px; margin: 0 auto; background-color: FFFFFF; }

#wrap { width:100%; }

#middle { width:960px; background: #000000; }
#center { width: 760px; float: left; background: #000000; }
#right { width: 200px; float: right; background: #c5c5c5; }

#footer-wrap { width:100%; height: 219px; }
#footer { width:960px; background-color:FFFFFF; }

#navwrap { width: 960px; background-color:#FFFFFF; }
#nav { width: 940px; height: 42px; background-color:E0E5EF; }
#pathbar { width: 760px; height: 30px; background-color:FFFFFF; }
#datetimeregion { width: 260px; height: 43px; float: left; padding-top: 4px; padding-left: 10px; }

#footermain { width: 960px; height: 180px; padding-top: 40px; font-family: verdana; font-size: 12px; color: #fff; }
#footermain a:hover { color: #fff; text-decoration: underline; }
#footermain a { color: #4682C3; text-decoration: underline; }

#footersub { margin-top: 20px; }

#menu1 { width: 200px; float: left; padding-left: 0px; padding-right: 10px; padding-bottom: 10px; margin-left: 0px; }
#menu2 { width: 200px; float: left; padding-left: 10px; padding-right: 10px; padding-bottom: 10px; margin-left: 20px; }
#menu3 { width: 220px; float: left; padding-left: 10px; padding-right: 10px; padding-bottom: 10px; margin-left: 20px; }



But for some reason it doesn't show correctly, see here

http://testobject.cwsurf.de/

abduraooft
12-20-2009, 05:37 PM
I've been having some trouble with this layout, particularly the center section. Im not sure what I am doing wrong. What's your expected output?

OGGordon
12-20-2009, 05:41 PM
What's your expected output?

I made a div called middle with two sub divs, center and right. Center is actually left with 760px width, while right should be on the right with 200px width.

But as you can see, center div is actually in the center, pushing right div too far right, so that's why the footer is not on the bottom but somewhere between. hope you understood what I mean.

OGGordon
12-20-2009, 05:47 PM
nvm it works now, I had a div there that I forgot to delete. Just went through the entire code again and fixed it. Thanks tho :D

Excavator
12-20-2009, 06:04 PM
Hello OGGOrdon,
You have uncleared floats in #top-wrap. You can clear them by using overflow:auto; like this
#top-wrap { width:100%; overflow:auto;}
You can put add background color on #top-wrap to get a better visual explanation on what's happening.

The same problem with #middle. On #middle, you see only part of your black background, add overflow:auto; and you see that div enclose the floats the way you'd expect.
You are asking for problems when you set your #center and #right elements to exact pixel widths of their container.
They might work a little better like this -

#middle {
width:960px;
background: #000000;
overflow: auto;
}
#center {
width: 750px;
float: left;
background: #a2a2a2;
margin-left: 10px;
padding: 5px 0 0 5px;
}
#right {
background: #c5c5c5;
margin: 0 10px 0 765px;
}


A couple last things,
It looks like you've done some cut/paste and got things out of order. Your DocType delcaration is being negated by the script line in front of it. Check out the validator for more errors.

And, your CSS reset has margin: 0 auto; in it. That means your centering everything... not sure that's really intended.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum