GUIDE深度 · Deep dive
可访问的 HTML 表格
表格不是视觉网格,而是有结构的数据。用 <caption> 说明表格主题,用 <th scope> 标出表头,屏幕阅读器才能把单元格和表头关联起来。
基本结构
<caption> 放表格标题;<thead>/<tbody> 分组。
表头用 <th scope="col"> 或 scope="row"。
不要做的事
不要用表格做页面布局。
不要跳过表头直接堆 td。
常见问题
caption 必须吗?
不是强制,但强烈建议;可用 aria-label 替代。
复杂表格怎么办?
用 scope/headers 关联,或拆成多个简单表格。