2006-07-31

Center content using CSS

With IE (v. 6 at least), things can get quite ugly. One has to use all sorts of dirty little tricks to make stuff render in at least approximately similar way across browsers. Here we center a fixed width <div id="main"/> on the page:

body {
 ...
 text-align: center; /* IE hack */
 ...
}

#main {  /* the main container div */
 min-height: 555px;
 height: 555px;
 min-width: 888px;
 width: 888px;
 margin: 0 auto 0 auto;
 text-align: left;  /* "cancel" the IE hack above */
}