CSS Div

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

He has: 3,022 posts

Joined: Oct 2002

Try this:

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

Smiling

He has: 629 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;}

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

He has: 3,022 posts

Joined: Oct 2002

No problem, glad it worked for you Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.