I'm pretty new to CSS and am trying to get my page to center. It has worked perfectly in IE but in Firefox it refuses to move over and it also won't fill the 100% space of the screen. See http://mattyboy.campinnovations.com.au for details. If anyone could be of help that would be great!

mb89

Desdinova

09-19-2006, 02:41 PM

give the element that needs to be centered the margin-left: auto; and margin-right: auto;
or shortly margin: 0px auto;

make sure it doesn't have a float, because floats don't center.

[edit]
and of course, the element that contains the element that needs to be aligned, should have style text-align: center;.

VIPStephan

09-19-2006, 03:03 PM

[...] and of course, the element that contains the element that needs to be aligned, should have style text-align: center;.
I can't agree with that. It doesn't matter how the text (or inline elements) are aligned within the centered element.
You were right with the margin: 0 auto; thing - which by the way only works with block level elements (like div, form, table, paragraph...) and in IE only if it's in standards mode.

And to clarify it for mb89: your div.master needs margin: 0 auto; in order to be centered.

Desdinova

09-19-2006, 03:07 PM

I can't agree with that. It doesn't matter how the text (or inline elements) are aligned within the centered element.
You were right with the margin: 0 auto; thing - which by the way only works with block level elements (like div, form, table, paragraph...) and in IE only if it's in standards mode.