WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: <td> Vs <th> tags for use of scope attribute and headers in data tables

for

From: Jared Smith
Date: Feb 10, 2012 8:21AM


On Fri, Feb 10, 2012 at 8:04 AM, Michael Burks wrote:

> I am interested in what people think about using the <td> tag instead of the
> <th> tag for row headers when using the scope attribute.

From a standards standpoint, it's a bit ambiguous in the HTML4/XHTML
specifications. Scope is allowed on both <th> and <td>, and the spec
states, "TH is for headers, TD for data, but for cells acting as both
use TD." Nearly all header cells (especially when there are both
column and row headers) could seemingly act as both.

In HTML5, the scope attribute is only allowed on <th> elements, not on <td>.

From a functional standpoint, the presence of <th> elements is a
primary mechanism used by browsers and assistive technologies to
identify and provide functionality for data tables, as opposed to
layout tables. It's been a few years since I tested, but I don't think
screen readers do anything special with scope on <td>s.

In short, if it's a header, use <th>.

Jared