Does WCAG 2.0 allow tables for layo开发者_开发技巧ut, I can't see anything in the guidelines saying you can't but this suprises me.
http://www.w3.org/TR/WCAG20-TECHS/H73.html
Although WCAG 2 does not prohibit the use of layout tables, CSS-based layouts are recommended in order to retain the defined semantic meaning of the HTML table elements and to conform to the coding practice of separating presentation from content
I'd add to @jordan answer that imbricated tables are inaccessible. A layout table must avoid using any element used in data tables, that is:
- no
caption
,thead
,tfoot
andth
elements (onlytable
,tr
,td
and optionallytbody
) summary
attribute (it can be empty),headers
,scope
(onlyrowspan
andcolspan
. Andid
obviously)- strange things like
axis
orcol
element
It must also be linearizable, that is, must make sense when cells are read from top to bottom and left to right.
Relevant WCAG 2.0 Failure Techniques are:
- F46: Failure (...) due to using th elements, caption elements, or non-empty summary attributes in layout tables
- F49: Failure (...) due to using an HTML layout table that does not make sense when linearized
Note: if you're using tables only for design constraints, then FYI you can use display: table;
(and table-row
and table-cell
) on every browser except IE6 and IE7.
精彩评论