Center Content CSS

NomadNomad A Small Piece of Hell Icrontian
edited September 2010 in Internet & Media
So I have looked at several ways to do this, and absolutely have not been able to get it to work. Something is wrong with my CSS.

My website is here, and in IE I cannot get the main div to center. Here is the top of my CSS:

[HTML]<style type="text/css">
body,
html {
margin:0;
padding:0;
color:#000;
text-align: center;
background:#fff;
}
#wrap {
margin-left:0 auto;
margin-right:0 auto;
width:760px;
text-align: left;
background:#fff;
}[/HTML]

Any ideas would be helpful

Comments

  • ardichokeardichoke Icrontian
    edited September 2010
    EDIT, correction, whatever:

    take out margin-left and margin-right from #wrap. Replace it with "margin:0 auto"

    margin-left and margin-right don't take 2 arguments (they are strictly the margin to the left and the margin to the right). Setting margin: 0 auto sets a 0px margin on top and bottom, auto margin on left and right.

    http://www.w3schools.com/css/css_margin.asp

    also: http://flumpcakes.co.uk/css/center-div-ie
  • NomadNomad A Small Piece of Hell Icrontian
    edited September 2010
    So I gave this a whirl and had it in a previous iteration, it still does not work. Any ideas?
  • ardichokeardichoke Icrontian
    edited September 2010
    I don't really know. Looks like IE isn't applying a lot of the CSS. The page renders a whole lot different on IE on my laptop than on Chrome. Text sizes look different, obviously the whole thing isn't centered. I don't think the divs are the same size. Not really sure what to tell you without starting to tweak your code which I don't have the time to do right now.
  • ThraxThrax 🐌 Austin, TX Icrontian
    edited September 2010
    I went through it with him, cleaned up his HTML and tracked the source of the issue down to the CSS. It's probably a conflicting tag.
  • ardichokeardichoke Icrontian
    edited September 2010
    You sure about that? Because I just loaded it 30 seconds ago and it's still not displaying right in IE8 for me. Not even in compatibility mode.
  • ThraxThrax 🐌 Austin, TX Icrontian
    edited September 2010
    Positive. It displays correctly in my installation of IE8, and we were able to center a brand new page using the same style sheet stripped of everything but the centering CSS.
  • ardichokeardichoke Icrontian
    edited September 2010
    ... and this is on the live site? Because it's still displaying wrong here
  • ThraxThrax 🐌 Austin, TX Icrontian
    edited September 2010
    ... and this is on the live site?

    No.
  • ardichokeardichoke Icrontian
    edited September 2010
    Okay then.
  • NomadNomad A Small Piece of Hell Icrontian
    edited September 2010
    ardichoke wrote:
    Okay then.

    No, we added an HTML page with new CSS and the issue went away, so I get to play the tag conflict game.
Sign In or Register to comment.