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

margin: auto

P: n/a
Updating my bag of tricks again.

What's the level of support for margin: auto. Is this widely
supported now amongst almost all browsers?

It's a common request to have a "centered" page. I don't remember
which major browser didn't support margin: auto, but there was a common
hack with some "text-aligns". Is it time to drop the hack?

Jeff
Feb 22 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Fri, 22 Feb 2008 21:50:42 +0100, Jeff <jeff@spam_me_not.comwrote:
Updating my bag of tricks again.

What's the level of support for margin: auto. Is this widely
supported now amongst almost all browsers?
Save MSIE6 and lower.
It's a common request to have a "centered" page. I don't remember
which major browser didn't support margin: auto, but there was a common
hack with some "text-aligns". Is it time to drop the hack?
Nope, MSIE6 still needs it. margin:auto on the element for any other
browser, text-align:center on the parent element for MSIE6.
--
Rik Wasmus
Feb 22 '08 #2

P: n/a
In article <13*************@corp.supernews.com>,
Jeff <jeff@spam_me_not.comwrote:
Updating my bag of tricks again.

What's the level of support for margin: auto. Is this widely
supported now amongst almost all browsers?

It's a common request to have a "centered" page. I don't remember
which major browser didn't support margin: auto, but there was a common
hack with some "text-aligns". Is it time to drop the hack?
IE 6 is the one to worry about. It will not centre a block with
margin: auto and a width.

--
dorayme
Feb 22 '08 #3

P: n/a
Rik Wasmus wrote:
On Fri, 22 Feb 2008 21:50:42 +0100, Jeff <jeff@spam_me_not.comwrote:
> It's a common request to have a "centered" page. I don't remember
which major browser didn't support margin: auto, but there was a common
hack with some "text-aligns". Is it time to drop the hack?

Nope, MSIE6 still needs it.
Nope, IE6 does *not* need it, at least not in standards mode.
Margin:auto works perfectly fine. IE5.x doesn't grok it, but who cares?

You shouldn't be coding for quirks mode any more anyway.

--
Berg
Feb 22 '08 #4

P: n/a
dorayme wrote:
In article <13*************@corp.supernews.com>,
Jeff <jeff@spam_me_not.comwrote:
>>
What's the level of support for margin: auto. Is this widely
supported now amongst almost all browsers?

IE 6 is the one to worry about. It will not centre a block with
margin: auto and a width.
bollocks

I use margin:auto all the time. It works perfectly fine in IE6.

--
Berg
Feb 22 '08 #5

P: n/a
On Fri, 22 Feb 2008 23:41:21 +0100, Bergamot <be******@visi.comwrote:
Rik Wasmus wrote:
>On Fri, 22 Feb 2008 21:50:42 +0100, Jeff <jeff@spam_me_not.comwrote:
>> It's a common request to have a "centered" page. I don't remember
which major browser didn't support margin: auto, but there was a common
hack with some "text-aligns". Is it time to drop the hack?

Nope, MSIE6 still needs it.

Nope, IE6 does *not* need it, at least not in standards mode.
Ah, most of my pages are valid strict 4.01, did seem to run into troubles
a time ago, maybe I used a lousy doctype back then...
Margin:auto works perfectly fine. IE5.x doesn't grok it, but who cares?
You shouldn't be coding for quirks mode any more anyway.
Amen.
--
Rik Wasmus
Feb 22 '08 #6

P: n/a
Jeff <jeff@spam_me_not.comwrites:
dorayme wrote:
>In article <13*************@corp.supernews.com>,
Jeff <jeff@spam_me_not.comwrote:
>> Updating my bag of tricks again.

What's the level of support for margin: auto. Is this widely
supported now amongst almost all browsers?

It's a common request to have a "centered" page. I don't
remember which major browser didn't support margin: auto, but there
was a common hack with some "text-aligns". Is it time to drop the
hack?

IE 6 is the one to worry about. It will not centre a block with
margin: auto and a width.

OK, I'm totally mixed up.

I've got IE6 on XP. It centers fine with margin: 0 auto, when I
have, it in standards mode and not in quirks mode.
That is what happens. See http://www.quirksmode.org/css/quirksmode.html
for a longer list of the differences.

As has already been said, if you use a standards-triggering DOCTYPE,
then IE6 is must less of a pain. I would not recommend doing anything
else, although there may be situations in which you are forced to*.

* Hmm... the most obvious is some managerial insistence on XHTML with
an XML prologue. This will trigger quirks mode.

--
Ben.
Feb 23 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.