tags:

views:

24

answers:

1

My Html markup

<div id="main-wrapper">

            <div id="header-wrapper">
                <div id="header">
                                    </div><!--end of #header -->
                <div class="clear"></div>
            </div><!--end of #header-wrapper -->

            <div id="content-wrapper"><!-- this is closed in footer.php -->    <!-- main image with its map -->
    <img usemap="#homemap" class="map" src="http://rtcamp.com/wp-content/themes/rtcamp-new/img/home-main.png"&gt;

            <div class="clear"></div> <!--clear any float present at this point -->
        </div><!-- End of #content-wrapper -->

        <div id="footer-wrapper">

        </div><!--End of #footer-wrapper-->         
    </div>

Used CSS

body.view-home #main-wrapper {
height:100%;
}

#main-wrapper {
margin:0 auto;
width:960px;


}

body.view-home #header-wrapper {
height:auto !important;
margin:0 auto -555px;
min-height:100%;
}


body.view-home #content-wrapper {
display:block;
height:555px;
margin:0 auto;
overflow:hidden;
position:relative;
width:980px;
}

In all browsers like firefox,chrome the main-wrapper div appears center in browsers but in IE7 the main-wrapper not appears in the center. It appears left side in the browser.

Please help me.

+1  A: 

Try these styles:

body {
  text-align:center;
}

#main-wrapper {
  margin:0 auto;
  width:960px;
  text-align:left;
}
Sarfraz
Hey sAc,Thanks Its working :) Thank you
saorabh
@saorabh: You are welcome....
Sarfraz
Explanation: `margin: 0 auto` does the actual centering. But as IE didn't support this, you have to give the parent of the to-be-centered div the property `text-align: center`. But now not only the div would be centered, but the text within it, so one has to reset this behaviour using `text-align: left`.
nikic
Hey sAc, Its working fine in IE7 but in IE8 its not working..please help me..
saorabh
it works in browsers like ie7 and ie8, i just tried it in my some another example and it works fine.Thanks
saorabh