[an error occurred while processing this directive]

si-blog
the web log of Simon Jessey

Sunday, February 9th, 2003

Let me float a different idea your way

Jeffrey Zeldman churns out interesting material at a prolific rate, most of which I munch eagerly in an effort to learn as much as I can about web design. Today he has written a brief piece commenting on an excellent article by John P. Gallant about the float model of Internet Explorer. Zeldman says:

Float is essential to all CSS layouts - it's how we tell elements to sit next to each other instead of lining up one after the other in Chinese fire drill formation.

All CSS layouts? This is a popular misconception, I think. It scares many designers away from CSS who find float rules difficult to understand. I know that sounds like a lame excuse, but have you actually read the float rules? They are not the easiest specifications to follow. Let me give you this teaser:

A floated box must have an explicit width (assigned via the 'width' property, or its intrinsic width in the case of replaced elements). Any floated box becomes a block box that is shifted to the left or right until its outer edge touches the containing block edge or the outer edge of another float. The top of the floated box is aligned with the top of the current line box (or bottom of the preceding block box if no line box exists). If there isn't enough horizontal room on the current line for the float, it is shifted downward, line by line, until a line has room for it.

Say what?

Since a float is not in the flow, non-positioned block boxes created before and after the float box flow vertically as if the float didn't exist. However, line boxes created next to the float are shortened to make room for the floated box. Any content in the current line before a floated box is reflowed in the first available line on the other side of the float.

Huh? I can just see Mr. Wysiwig eating all that up with gusto.

Anyway it's time I got to the point of this blog entry. I think Zeldman has dismissed those designers who prefer the slightly more rigid approach of using absolute positioning. Since I first became aware of Cascading Style Sheets I have been using absolute positioning to control the layout of my sites. Contrary to the use of float, I rarely have unexpected or difficult-to-fix issues with it. I prefer to limit the use of float to displaying images or little div elements with quotations in and the like. But it seems that absolute positioning is not trendy enough. I don't understand this at all, because I would have thought that designers who are used to using tables for laying out everything would at least find comfort in placing div elements wherever they like.

Maybe I'm just being an old fart.

[an error occurred while processing this directive]
[an error occurred while processing this directive]