Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Alignment in IE

  • This topic is empty.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #37031
    downbylaw
    Member

    Hi guys!

    the last few days I’ve been struggeling with an issue in IE… Alignment! I’m trying to align the div ‘container’ in the center of the browser. All browsers (Safari, Chrome, Firefox, Opera) handle the css (margin-left: auto; margin-right: auto;) fine but IE explorer doesn’t at all. It basically ignores that.

    I’ve been checking around and found some work arounds that seem to work for other people but not for me. I’ve created a folder on my website to test this simple issues. http://www.test.kh-media.be/public

    I’ve tried to create a wrapper with css (position: absolute; width: 100%;) for around the container. Didn’t work.

    Text-align: center; for the container. Didn’t work.

    CSS can be viewed in http://www.test.kh-media.be/css/main.css

    Can somebody help me with this issues because it’s becoming a real PITA…

    Thanks

    #98412
    Senff
    Participant

    Can you show the HTML as well? I don’t see anything wrong in the CSS right away.

    #98414
    downbylaw
    Member

    How do I post clean code so it doesn’t render

    #98525
    downbylaw
    Member

    Anyone? So I can paste my html? It keeps rendering…

    #98545
    Senff
    Participant

    Paste HTML — select all HTML — click the button at the top of the text area (white paper with blue thingies on it).

    #98553
    downbylaw
    Member





    KH Media | Web en audiovisuele oplossingen






    Could this doctype solve it?

    #98554
    TheDoc
    Member

    The doctype needs to come before the html tag.

    #98555
    TheDoc
    Member

    NOt having a doctype throws IE into Quirks Mode which basically means it goes crazy.

    #98565
    karlpcrowley
    Participant

    The start of your html pages should really look something like this





    The rest of your code as normal....

    It’s vital to have the meta charset before the title to prevent a certain type of xss hack
    the rest of the code will make IE render the page as it should

    #98576
    Vermaas
    Participant

    This is what i use very often:















    And with the css to align the container in the middle:


    #container {
    width: 970px;
    margin: 0px auto;
    }

    If your div, which you want to center, has no width, it’s almost impossible to align it in the middle of the screen. This is a good way to center your div. For the div’s (header, section, footer) inside the wrapper, just use float.

    Hope this is helpfull to you.

    #98580
    Senff
    Participant

    Also not very good:

    			

    XX
    #98582
    Paulie_D
    Member

    Also…

    is not a good idea.

    Just give the wrapper/container a

        border-top: 5px solid red;

    See..http://jsfiddle.net/Paulie_D/LS7dr/

    #98659
    downbylaw
    Member

    Thanks guys for reviewing my script. The problem is solved now but what about Senff’s comment… What’s wrong with using that div? Should I consider section? What are pro’s and con’s?

    Thanks

Viewing 13 posts - 1 through 13 (of 13 total)
  • The forum ‘CSS’ is closed to new topics and replies.