On 21/04/2011 11:09 PM, John Jimenez wrote:
Hello all,
I am looking for the benefits of setting all divs to
position:relative. I have come across a number of sites (included some
of the ones I work for) that have this reset and I can't find the pros
or cons via Google.
I ask because this seems to trigger a bug in IE (tested as high as 8)
that behaves like the hasLayout bugs but does not get fixed with the
standard zoom:1. The only way to fix the issue was to expressly reset
the div to position:static.
Is the IE issue caused by a doctype that triggers quirks mode [1]
perhaps? IE8 should show the same as other good browsers.
Anyone here able to provide some insight on the pros/cons of this
seemingly increasingly common reset?
Thanks!
John Jimenez
Firstly it's not a reset. A reset only resets the values of the default
style sheet [2] in each and every browser.
OK, this is what I think is happening with this position: relative
appearing in the style sheets of some sites. The coders are coding for
the buggy versions of IE. These are IE5.5, IE6 and IE7. Position:
relative can be used to fix the peekaboo bug and other IE CSS bugs [4]
but at the same time position: relative can cause other IE CSS bugs.
If you're coding to standards, you don't need position: relative unless
you need it [5] [6] and this is usually for creating a new containing
block for absolutely positioned elements.
If position: relative is needed to fix a IE7- CSS bug, consider using a
CSS hack (with comments about use) or CC so others coders know why it is
used in the first place.
[1] http://hsivonen.iki.fi/doctype/#handling
[2] http://css-class.com/test/css/defaults/UA-style-sheet-defaults.htm
[3] http://www.positioniseverything.net/explorer/peekaboo.html
[4] http://www.positioniseverything.net/explorer.html
[5] http://www.w3.org/TR/CSS21/visuren.html#positioning-scheme
[6] http://www.w3.org/TR/CSS21/visuren.html#relative-positioning
--
Alan Gresley
http://css-3d.org/
http://css-class.com/
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/