开发者

WCAG 2.0 Using tables for layout

开发者 https://www.devze.com 2023-03-13 07:06 出处:网络
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

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 and th elements (only table, tr, td and optionally tbody)
  • summary attribute (it can be empty), headers, scope (only rowspan and colspan. And id obviously)
  • strange things like axis or col 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号