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 4 of 4
  1. #1
    Mfx
    Mfx is offline
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with layout alignment

    Hi im currently working in this layout, I'm a beginner using dreamweaver, the problem is that the layout is aligned to the right when I want it in the middle, could someone tell me the code to put it in the center.

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    There will need to be alot of work done. You could simply go in and create a wrapper and center it. then enclose the div around all of the content like so

    Code:
    .wrapper {
    width:800px;
    margin:0 auto;
    }
    then it would center.. but unfortunately almost all of your images are positioned using absolute positioning... which you would need to get rid of all of that in ourder to get it to center.

    I hope this helped a little.

  • #3
    Mfx
    Mfx is offline
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok I've posted an ad for someone to do it. Thanks anyway.

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,688
    Thanks
    22
    Thanked 1,829 Times in 1,813 Posts
    Hello Mfx,
    The easiest way to center things needs:
    • DocType
    • width of the container
    • container's left/right margins set to auto


    What's messing yours up is some odd CSS and some of your absolute positioning. See http://www.tyssendesign.com.au/artic...ning-pitfalls/

    We can center your containing div by fixing this line in red -
    Code:
    #centered
    {
            width:		1119px;
            margin:		0 auto; 
            text-align:	justify; 
            position:	relative;	
    }
    If you resize your browser you can see now that your you bg.gif doesn't line up.
    Typically a background be the background of the container it was made for, like this -
    Code:
    body {
    	background:	#D5D5D5;
    	text-align:		center; /* for IE */
    	margin:			5px;
    	font:		12px/15px trebuchet ms;
    	color:			#575757;
    }
    
    #centered {
            width:		1119px;
            margin:		0 auto; /* to center the div */
            text-align:	justify; /* restore the body alignment */
            position:	relative;
    	background:	url(bg.gif) repeat-y;
    }
    But, again, the absolute positioning is messing with it.

    You should have a look at the links in my sig about validation.

    ...

    And finally, to center your page. This is really not the normal way to do it. I've shown you how it should be done and why that's not working for you but, since fixing it would require a total re-write, ...this works here locally in FireFox -
    Code:
    body {
    	background:	#D5D5D5 url(bg.gif) repeat-y center;
    	text-align:		center; /* for IE */
    	font:		12px/15px trebuchet ms;
    	color:			#575757;
    }
    
    #centered
    {
            width:		1119px;
            margin:		0 auto; /* to center the div */
            text-align:	justify; /* restore the body alignment */
            position:	relative; /* because of "relative/absolute" content inside the div */	
    }
    Last edited by Excavator; 03-06-2009 at 06:53 PM.
    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
    •