justuptime.com - monitor your servers & websites

CSS Div

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
AveSatani_666's picture

He has: 21 posts

Joined: Aug 2007

hi guys, i forgot how to align div to middle in my CSS,

for ex:

div.body
{
width: 800px;
}

and then...? what will be the next code to be aligned in center...

thanks...Sad

Renegade's picture
Moderator

He has: 2,944 posts

Joined: Oct 2002

Try this:

div.body {
width:800px;
margin:0 auto;
}

Smiling

He has: 343 posts

Joined: May 2007

... and if you want this to work in IE 5.5 (or IE 6/7 in quirks mode) add;

body {text-align: center;}
div.body {text-align: left;}

Cordially, David
--
"Old web developers don't die, they degrade gracefully..."

AveSatani_666's picture

He has: 21 posts

Joined: Aug 2007

thanks guys, im gonna try all your replies... Smiling

AveSatani_666's picture

He has: 21 posts

Joined: Aug 2007

great...! thanks for both of you Renegade and webwiz... Smiling

hope to learn from you more...

Renegade's picture
Moderator

He has: 2,944 posts

Joined: Oct 2002

No problem, glad it worked for you Smiling