Previous Message
Next Message

Absolute positioning vs float

Sent by Donna Casey on 31 January 2005 19:07


> When it comes to layout, I've been looking a lot at both absolute positioning and floats as the
two primary options for page 
> layout (I know there is also relative positioning, but it seems that AP and floats are the best
options for the basic layout). I 
> was wondering if there is any concensus in the web design community as to which is more kosher
for essential page layout. 
> Is there any sort of generally agreed-upon rules for when you use which? Or is it pretty much up
to individual preference?
  Neither seemed inherently better, both having their own quirks and
> frustrations. Thus my question about the philosophy behind their use.
> 
> What say ye?

All are valid and I don't think you should exclude any method--with 
respect to "better" - but instead, understand and use what is 
best-suited for a particular layout and element. I personally use 
relative positioning with floated elements and absolutely positioned 
elements... for me, it depends upon a) will the element need to expand 
vertically and readjust the position of the other content or not? and b) 
will the element contain user-sized text content?

For example, a banner on the top with an image-based navigation system 
would fit nicely into the top margin of a wrapper div and never get cut 
off--therefore, it could be absolutely positioned (a/p)without issues.

However, if that same banner contains my navigation that is text-based 
(and therefore sized based on the user's preferences and view/zoom 
options) it would need to be relatively positioned before any lower 
content. That allows the lower content to reposition to accommodate the 
previous content.

A similar logic process for left or right elements determines whether I 
use float or a/p. For example, if I need to have a border wrap 
everything, and my left navs expand (like a tree menu) then I float it 
into the left margin of the main content, with a wrapper that has 
borders and setup a clearing element to force the wrapper to "see" the 
float. You could not do that with an a/p nav element because the wrapper 
would not "react" to the left nav element at all, other than for 
placement (left, top, etc) and z-index.

So you see, all three are really indispensible. Why handicap yourself by 
eliminating the possibility of any option?

Just my two cents.

Donna Casey


______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: