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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    219
    Thanks
    25
    Thanked 1 Time in 1 Post

    Can't seem to center the columns

    I've got this coding which produces two columns next to each other in the top. And one columns below that.

    I've tried several things to get all columns centered in the middle, without succes :S

    Who can help me out?

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    
    <title></title>
    </head>
    <body style="margin: 0 auto;">
    <div style="text-align: center;">
    	<div style="position: relative; top:30px; width:896px; height: 196px; background: orange;">
    		<div style="float:left; width: 196px;height: 196px; background: lime;">links</div>
    		<div style="float:right; width: 700px;height: 196px; background: green;">rechts</div>
    	</div>
    	<div style="clear: both;"></div>
    	<div style="width: 896px; min-height: 600px; background: purple;">lol</div>
    
    </div>
    </body>
    </html>

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    you have to set a width to the body.

    you probably want to set it to a tag other than the body.

    Code:
    .inner { width: 960px; margin: auto; }
    Code:
    <body>
     <div class="inner">
    
     </div>
    </body>

  • Users who have thanked Sammy12 for this post:

    docock (07-18-2011)


  •  

    Posting Permissions

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