Greg's Blog

helping me remember what I figure out

Centered Designs CSS Stylee

| Comments

This is a real short one. A while back I got inpired about Doug Bowman’s work for a client (Adative Path) where he was using CSS to control layouts, determening from within the style sheet whether or not to have 1, 2 or three columns to display content. This alone blew me away, as it does work so well. I added the following stylesheet definition to one of our sites to add a simple centered layout:

#content {
margin: 0 auto 0 auto;
}

I lifted this little bit of CSS from this site.

I should also point out the #content is a div that encompasses the previously mentioned three columns.

Update: Well I noticed that this doesn’t work with IE 5.5, but as usual there is a work around.

body {
background: #fff;
text-align: center;/* centre it for IE5.5 */
voice-family: “"}"”; /* Now re-adjust for Mozilla and IE6 since we don’t want all of our text centred*/
voice-family:inherit;
text-align: left;
}