If given the opportunity, I would transition to css-based layouts. While the arguments for semantic structure are valid, practical considerations come into play as well. Here are some reasons why tables can be beneficial:
- Prevent 'float wrap' occurrences where a div shifts to the next line due to limited space.
- Create columns of equal height.
- Allow for dynamic layouts where dimensions are not predetermined until runtime.
- Support colspans and rowspans.
- Minimize inquiries on Stack Overflow about achieving certain design elements without resorting to tables :)
Although there are CSS display properties like table-cell that attempt to replicate this functionality, their compatibility across browsers may still be an issue (unless user browser settings can be controlled).
For the website I manage, varying column widths in layouts must be accommodated dynamically. Multiple clients utilize the same site templates, introducing uncertainty regarding content placement within menus, headers, and cells. By employing a single outer table for structuring the main site sections, I can maintain flexibility without concerns about menu width affecting content positioning or background color coverage.
In my ideal scenario, <table>
tags would strictly correspond to tabular data while a separate set of tags, perhaps labeled <layout>
, would handle layout arrangements with row and cell components. Alternatively, incorporating a 'mode' attribute in the <table>
tag—featuring values for 'data' and 'layout'—could signal to screen readers and search engines how to interpret the content. Perhaps such enhancements could emerge in HTML 6...
Edit: Regarding the issue of 'float wrap,' a recent question on Stack Overflow presents a somewhat effective solution here. Although it might seem complex, this approach could address the problem in various scenarios.