473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

margin: auto

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
6 5105
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alex Bell | last post by:
I am developing at http://www.members.iinet.net.au/~abell1/test/index.htm with city.css at http://www.members.iinet.net.au/~abell1/test/city.css. Both validate. In index.htm there is a block of...
3
by: Blacksmith | last post by:
Hi, I'm a CSS noob, and I'm trying to implement a very basic layout but am having problems in certain browsers. Basically, I want a horizontally centred box with a fixed width of 750px, with a...
0
by: GTalbot | last post by:
Hello fellow stylesheet colleagues, Load this url: http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForPargDisappear.html I would appreciate it if someone could explain 1-...
2
by: GTalbot | last post by:
www.authoring.html] Hello fellow HTML and markup coder colleagues, Please visit this url: http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForPargDisappear.html I would...
1
by: Dave Siegel | last post by:
Hi, I've made a container div and put 2 div's inside of that for easy positioning.. The problem is that the container div has a standard 10px or so top margin which makes it go down too much.....
1
by: superDk | last post by:
Hello, IE6 is adding a large margin between my two containers (container1 & container2) everything works fine in IE7 and Firefox. I've been searching on-line for a fix but I've had no luck. It...
7
by: GTalbot | last post by:
Hello fellow authoring.stylesheets colleagues, Can someone please explain why the bottom margin of the last inflow block-level child in an overflowed parent should not have its margin reachable....
5
by: David Schwartz | last post by:
I've got a sidebar element that's a floating div. To the left of this div, there are p's each with a margin-right set as well as overflow: auto set (see below)). Some of the p's are of class...
1
by: innivive | last post by:
I am having a problem with having margins display correctly in IE7, Firefox and Safari. I am not sure if it is the "double margin error" or something else. Any help would be appreciated. The file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.