immanuelx2 Posted June 6, 2007 Share Posted June 6, 2007 how can i set my <div class="container"> to be in the center of the page, with a width of 800px ? div.container {width:800px; align:center;} no worky Quote Link to comment Share on other sites More sharing options...
immanuelx2 Posted June 6, 2007 Author Share Posted June 6, 2007 figured it out... In mozilla you can do the following: div.container {width:800px; margin-left:auto; margin-right:auto;} In IE you have to use 2 divs... div.page {text-align:center;} div.container {width:800px; text-align:left;} Quote Link to comment Share on other sites More sharing options...
bronzemonkey Posted June 6, 2007 Share Posted June 6, 2007 I think if you use body {text-align:center} then you don't need 2 divs for IE Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted June 6, 2007 Share Posted June 6, 2007 i use: html body { text-align: center; } in IE 7 to center containing divs Quote Link to comment Share on other sites More sharing options...
calabiyau Posted June 6, 2007 Share Posted June 6, 2007 I still use IE 6 and margin-left: auto margin-right: auto has always worked to centre things in that browser. Does this no longer work for IE 7? Why the need for separate rules for IE from Firefox? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted June 7, 2007 Share Posted June 7, 2007 margin: auto is the preferred method... IE7 is much closer to a standards compliant browser than previous incartnations so the need for separate css should diminish over time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.