CSS
-Tricks
treehouse :
what would you like to learn today?
Web Design
Web Development
iOS Development
Show search box
Search
Search in:
All
Articles
Forums
Snippets
Videos
✕
Home
Forums
Snippets
Gallery
Videos
Almanac
Demos
Lodge
Navigation 'n' Search
Forums
Illustration by Nick Sirotich
Forums
»
CSS Combat
IE 7 Centering
zanuka
Permalink to comment
#
June 2009
trying to center my page layout in IE 7.
works fine in Safari, Firefox, Opera with the following :
body {
margin: 0 auto;
min-width: 990px;
width: 990px;
background: #000000 url(../images/bg.jpg);
background-position: 50% 0;
background-repeat: repeat-y;
padding:0;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 13px;
}
but I can't seem to get it to center properly in IE 6/7
any ideas?
cheers,
zanuka
AshtonSanders
Permalink to comment
#
June 2009
Add
html { text-align:center;}
You need that on your parent element to get margin: 0 auto; to work in IE.
Then you need "text-align:left;" on your <body> tag to make your text align left again.
(Although, I would not use your body as your page outline, I would make a <div ID="container"> or something similar.)
Add a Comment
works fine in Safari, Firefox, Opera with the following :
body {
margin: 0 auto;
min-width: 990px;
width: 990px;
background: #000000 url(../images/bg.jpg);
background-position: 50% 0;
background-repeat: repeat-y;
padding:0;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 13px;
}
but I can't seem to get it to center properly in IE 6/7
any ideas?
cheers,
zanuka
html { text-align:center;}You need that on your parent element to get margin: 0 auto; to work in IE.
Then you need "text-align:left;" on your <body> tag to make your text align left again.
(Although, I would not use your body as your page outline, I would make a <div ID="container"> or something similar.)