If you go to my site you'll see that I am using:

margin: 1em auto;

on the container element.

Yet for some reason this won't centre the content in the middle of the page. There seems to be a greater margin on the right than the left.

What do I need to do so that the container is centred?

Thanks.

2 answers

0
points
This was chosen as the best answer

if you add:

#container{overflow:hidden; border: 1px solid red;}

to your style sheet you'll see that the container is too wide for its content, but is in fact centered as requested.

resolve this by using a width for #container equal to its content, or making the content wider to fill the container.

Answered about 6 years ago by Tony Crockford
olivaw 0
0
points

Ah yes that fixed it.

Thanks very much!

Answered about 6 years ago by olivaw