People use position:relative
instead of margins to help avoid margin collapse.
Here's some links in case you aren't familiar with margin collapse.
http://www.w3.org/TR/CSS2/box.html#collapsing-margins
http://www.andybudd.com/archives/2003/11/no_margin_for_error/
Gunlaug Sørtun wrote:
Naveen
Bhaskar wrote:
I have seen a page where all the divs are
positioned with position relative and with top , bottom attributes
instead of margin.. Is this a good method?
Depends entirely on the actual layout. I often use both relative offset
and margin push/pull on the same elements.
Position relative doesn't move the element, only offset it visually -
the element still takes up space in its original, non-positioned,
position.
Margins affects the element's actual position. When used on floats
margins can remove the element-space partly or entirely.
There is no browser compatibility issues
while using this where as when using margin properties IE has probelms.
IE6 has serious problems with position relative in certain
combinations,
but provoking bugs with margins isn't a problem either in that old
bugger. IE7 is better but far from flawless.
IE7 and older introduce positioning and margin problems related to
'hasLayout'[1], where the cure for one bug often causes more problems
than the disease.
regards
Georg
[1]http://www.satzansatz.de/cssd/onhavinglayout.html
******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [email protected] *******************************************************************
|