I know there are various good arguments preferring CSS positioning over table-based layouts. What I’m wondering is whether the CSS model is complete (assuming a relatively modern browser) with respect to ALL of the capabilities of tables. Are there layouts that tables can achieve that are impossible or impractical with CSS?
I know there are various good arguments preferring CSS positioning over table-based layouts. What
Share
I would switch to css based layouts if I could. The sematic arguments are correct, but there are practical considerations. Tables will:
There are css display properties (table-cell, etc) which mimic some of this, but I don’t believe the support is widespread enough to use them yet (unless you can control your user’s browser selection).
The site I work on requires competely dynamic column widths in the layouts. Multiple customers use the same site templates, and I have no idea what they will put into the menu or page header or content cells. (And no idea what they will find attractive, which is another issue…) Using a single outer table to lay out the main sections of the site allows the flexibility I need without worrying that a slightly-too-wide menu will push the main content box down to the next row, or that background colors won’t fill the required height.
In a perfect (to me) world, we would have
<table>s for tabular data, and another, nearly identical set of tags for layouts – call it<layout>(along with corresponding row and cell tags). Or, add a ‘mode’ attribute to the<table>tag – the values would be ‘data’ and ‘layout’ so that screen readers and search engines would know what to do. Maybe in html 6…Edit: I shoud add, regarding the ‘float wrap’ thing – there is a current question on SO with an answer that works pretty well here. It is not perfect, and too me it is too complicated, but it would resolve the problem in many cases.