Centering containers in CSS

They have: 12 posts

Joined: Jan 2006

I have bothered you all enough and have finally got it. First, thank you to everyone who helped. One last thing and I think I have the hang of this relative positioning stuff.

How do you center the following code. After this answer my nightmare is over,

thanks in advance,
scott

THE CODE:
________
#container{
position: relative;
top:45px;
width:766px;
height:716px;
background-image: url(images/sitecssbg.jpg);
}

Busy's picture

He has: 6,151 posts

Joined: May 2001

text-align:center;

Are these posts all on the same subject? Please try to keep all posts on the same topic within it's parent thread, if you would like these to be merged, let us know. Cheers

They have: 12 posts

Joined: Jan 2006

apologies. New here Smiling

I centered it, but the site won't display the same in relative positioning. Does it have to go into a table or? I honestly have no idea and need to figure this out.. im in a deep nightmare...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Have you tried margin: 0 auto; ?

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.