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 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post

    margin: auto for ie

    I have a background image that repeats to border the left and right side of my content... the content is wrapped with

    .wrap800{
    width: 800px;
    margin-left: auto;
    margin-right: auto;
    }

    and in mozilla it works.. as usual.. in IE it looks like it needs to be shifted 5px right.

    What do I do?
    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.

  • #2
    New Coder
    Join Date
    May 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well first of all to simplify your code you can use

    Code:
    .wrap800{
    width: 800px;
    margin: 0 auto;
    }
    The way I get IE to behave properly is to make another <div> to wrap around the other one with a text-align:center;
    So it will look like:

    Code:
    .wrap800{
    width: 800px;
    margin: 0 auto;
    }
    
    .wrapper{
    text-align:center;
    }
    And simply nest the .wrap800 inside the .wrapper div. Hope this helps.

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,701
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    Uhm… not sure if this is a good idea as you are adding a useless empty div. Can you post a link to your problem (for better imagination thereof)?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Its your doctype. You are either lacking one or using a partial one. Coding properly to begin with saves from dealing with simple issues like this. Use a full doctype. I recommend this one
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    Also I recommend using different naming techniques on your class and/or ids. They need to be descriptive but something like wrap800 doesn't work to well because what if you decide to go bigger or smaller? Sure its probably only there one time but for other classes and ids you'll have to change them. Make them meaningful.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jan 2007
    Posts
    64
    Thanks
    0
    Thanked 1 Time in 1 Post
    I totally agree with you... That was a quick and dirty thing. Thanks for the help.. it works
    No trees were harmed in the transmission of this message.
    However, a rather large number of electrons were temporarily
    inconvenienced.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •