By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,073 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

'auto' value question..

P: n/a

at work they decided to center divs thus:

body {text-align:center}
#content {width: 612px; text-align:left; margin: 0 auto 0 auto; }

this works fine in IE & FF, EXCEPT in FF it doesn't work if I change
'auto' to 0 for left and right margin values; I have to leave those at
'auto'.. so I would like to know what exactly means 'auto' -- what
value it represents exactly (and does it apply for all elements/values
you might apply 'auto' to?)

(please don't tell me I should do this differently, I don't think they
will change the template at this point.. I had not say in it.. I just
would like to know what I can expect from 'auto' value..)

thank you very much..

Aug 1 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
maya wrote:
>
at work they decided to center divs thus:

body {text-align:center}
#content {width: 612px; text-align:left; margin: 0 auto 0 auto; }

this works fine in IE & FF, EXCEPT in FF it doesn't work if I change
'auto' to 0 for left and right margin values; I have to leave those at
'auto'.. so I would like to know what exactly means 'auto' -- what
value it represents exactly (and does it apply for all elements/values
you might apply 'auto' to?)
It doesn't represent a value exactly. It means that you are leaving it
to the browser to figure out the best value. Of margin-left,
border-left, padding-left, width, padding-right, border-right, and
margin-right, if you specify measures for some and auto for the others,
the browser works out the autos as it thinks most suitable.
Aug 1 '06 #2

P: n/a
Harlan Messinger wrote:
maya wrote:
>>
at work they decided to center divs thus:

body {text-align:center}
#content {width: 612px; text-align:left; margin: 0 auto 0 auto; }

this works fine in IE & FF, EXCEPT in FF it doesn't work if I change
'auto' to 0 for left and right margin values; I have to leave those at
'auto'.. so I would like to know what exactly means 'auto' -- what
value it represents exactly (and does it apply for all elements/values
you might apply 'auto' to?)

It doesn't represent a value exactly. It means that you are leaving it
to the browser to figure out the best value. Of margin-left,
border-left, padding-left, width, padding-right, border-right, and
margin-right, if you specify measures for some and auto for the others,
the browser works out the autos as it thinks most suitable.
thanks Harlan! :)

Aug 1 '06 #3

P: n/a
maya wrote:
margin: 0 auto 0 auto;
This could be summarised as:

margin: auto;

saving 8 bytes. :-)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Aug 1 '06 #4

P: n/a
Toby Inkster wrote:
maya wrote:
>margin: 0 auto 0 auto;

This could be summarised as:

margin: auto;

saving 8 bytes. :-)
That would be margin: auto auto auto auto, not margin: 0 auto 0
auto--unless auto necessarily resolves to 0 for vertical margins. Does it?

In any event, it could definitely be abbreviated to margin: 0 auto.
Aug 2 '06 #5

P: n/a
Harlan Messinger wrote:
That would be margin: auto auto auto auto, not margin: 0 auto 0
auto--unless auto necessarily resolves to 0 for vertical margins. Does it?
It does.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Aug 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.