Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post

    Problem with Sitelayout

    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:

    Code:
    <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

    Code:
    *{ 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/

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    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?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    Quote Originally Posted by abduraooft View Post
    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.

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    140
    Thanks
    29
    Thanked 1 Time in 1 Post
    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

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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 -
    Code:
    #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.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •