Trouble Centering My Page

Discussion in 'CSS' started by BadXAsh, Mar 6, 2009.

  1. #1
    Hello All!

    I'm at a stand still. I have two issues...

    Issue #1 I cannot seem to get my page centered. I think I've tried everything.
    I used the

    
    margin-left: auto;
    margin-right: auto;
    width: 50em;
    
    Code (markup):
    in the container section, this doesn't budge it an inch. It seems cemented to the left hand side. This has been a thorn in my side for quite some time.

    I've tried adjusting other numbers and such but to no avail. What am I doing wrong? If it helps I can post my code

    #2 is In IE all my sliced images are shifted down very slightly. In Firefox it looks perfect.

    Thank you for anyone can point me in the right direction!
     
    BadXAsh, Mar 6, 2009 IP
  2. nyxano

    nyxano Peon

    Messages:
    417
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    For #1, Try:

    margin: 0 auto;

    ... OR ...

    margin: 0 auto; clear: both;


    I have no answer for #2 - sorry.
     
    nyxano, Mar 6, 2009 IP
  3. BadXAsh

    BadXAsh Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmmm neither had any effect on it. It's like hitting a brick wall and hoping it will move. Tried both margin: 0 auto; & margin: 0 auto; clear: both; in the container section.

    
    body {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	margin: 0 auto;
    	padding: 0;
    	text-align: center;
    }
    
    #container {
    	width: 80%;
    	margin: 0 auto;
    	clear: both;
    	border: 1px solid #000000;
    	text-align: left;
    }
    
    Code (markup):
     
    BadXAsh, Mar 6, 2009 IP
  4. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #4
    I think it's the text-align: left; in you #container. Try putting text-align: left; in the divs that's placed in #container rather than #container.
     
    qazu, Mar 7, 2009 IP
  5. Mw_WebDesigns

    Mw_WebDesigns Banned

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Have you tried this for your body tag in your css:

    body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    margin-right: auto;
    margin-left: auto;
    padding: 0;
    text-align: center;
    }


    If that does not work aligning your #container should do it try using:

    #container {
    width: 80%;
    margin-right: auto;
    margin-left: auto;
    clear: both;
    border: 1px solid #000000;
    text-align: left;
    }


    Hope this helps.

    -Matt.
     
    Mw_WebDesigns, Mar 7, 2009 IP