Re: HTML 4.01 Strict table attributes and downplayed errors

Henri Sivonen wrote:
> On Jun 8, 2009, at 10:45, Ian Hickson wrote:
>> At the end of the day, using the align="" and valign="" attributes to 
>> control alignment on cells is a false economy.
> 
> I disagree about align. It's by far the most common table formatting 
> characteristics that the person managing the data in the cells would set 
> even if the overall visual appearance is controlled by another person.

In my experience, cell alignment in data tables most commonly applies on 
a per-column basis, such that all data cells in a given column will, for 
example, be aligned right.  Using a per-cell alignment mechanism is 
really a kludge that is indicative of the bigger problem of the severely 
limited support for column-based styling in CSS.

Ideally, we'd be able to select cells based on which column they were 
in, perhaps somehow selecting based on the cell's associated <col> or 
<colgroup> element. But, unfortunately, we can't.

I have observed many authors work around this limitation by using class 
names and CSS, typically resorting to presentational classes like 
class="right" or class="center".  (Although, I have personally used more 
meaningful class names like class="number", I believe I'm in the minority.)

I don't have any data on this beyond my own anecdotal observations, but 
the wide use of such presentational class names really isn't much better 
than using the align attribute.  However, repeating either attribute on 
individual cells is really inconvenient, especially for large tables. 
Using a WYSIWYG editor can make it easier, but that doesn't really help 
hand-coders.

The following solutions can be considered:

* Allow align="" on col and colgroup elements
   - Easy for authors to assign once per column.
   - Only appears to be supported by Opera.

* Allow align="" on td and th elements
   - Can be quite repetitive and time consuming for authors,
     especially hand-coders
   - Widely supported in browsers

* Style attribute
   - Widely supported in browsers
   - Allows more flexibility with styling beyond simple alignment.
   - Repetitive and time consuming for authors

* Class names and CSS
   - Widely supported in browsers
   - Allows more flexibility with styling beyond simple alignment.
   - If presentaional class names are used, not really better than align
     attribute.
   - Repetitive and time consuming for authors

* Fix CSS limitations with column-based styling
   - Ideal solution in theory, but currently impractical.
   - Will take a long time to develop and deploy.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Tuesday, 9 June 2009 11:28:17 UTC