Treehouse: Grow your CSS skills. Land your dream job.

IE6, 100% Width & Centering

  • # April 16, 2010 at 6:36 pm

    On most of my sites I use a css class like this:

    .center {
    width: 100%;
    text-align: center;

    Which I use to center any text on the site that needs to be centered. The problem is that IE6 is throwing me a strange problem. The text centers, but it is like the width is only set to 50%. This results in really ugly centered text. I can’t figure out a solution, any suggestions? Why might this be happening, it doesn’t make sense to me.

    # April 16, 2010 at 6:41 pm

    Maybe I’m not thinking this through enough… but why bother with the 100% width?

    # April 16, 2010 at 6:54 pm

    Sorry, I should have mentioned that I am applying this to block elements (div, h1, etc). If width: 100%; is not set that it has no effect since the element is only as wide as the text itself.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.