[thelist] pros and cons of absolute positioning in css

Peter-Paul Koch pp.koch at gmail.com
Wed Feb 23 14:35:55 CST 2005


> > It occurs to me that I've been avoiding the use of absolute
> > positioning in my CSS and in the back of my head I think there is a
> > good reason for this, but for the life of me I can't remember what
> > that reason is. I think it would make my work much easier if I used
> > absolute positioning; I could more precisely position elements in my
> > layout, and I could order my html in a more search-engine friendly way
> > while having it laid out (visually) in a different order.
> >
> > Can someone tell my why absolute positioning is not recommended, or
> > let me know if I'm torturing myself unnecessarily?

Lack of flexibility.

Liquid design becomes very difficult, even when you work with
percentages, which have to be rounded to pixels, which will never add
up to 100% (rounded to pixels) even without box model problems.

Besides, try enlarging the text in an absolute layout. More likely
than not the boxes become too small and the text starts doing
memorable things. The solution, giving every single element an
overflow: auto, gets ugly in a hurry.

Better not to use absolute positioning. It complicates things more
than necessary. Floats are more difficult, but also more reliable once
you've worked around all browser bugs.

-- 
-------------------------------------------------------------------
ppk, freelance web developer

Recent article: JavaScript triggers, 
http://www.alistapart.com/articles/scripttriggers/

Bug Report: Report bugs yourself, or comment on previously 
reported ones.
http://www.quirksmode.org/bugreports/
------------------------------------------------------------------


More information about the thelist mailing list