files/en-us/web/api/htmltablecellelement/scope/index.md
{{ APIRef("HTML DOM") }}
The scope property of the {{domxref("HTMLTableCellElement")}} interface
indicates the scope of a {{HTMLElement("th")}} cell.
Header cells can be configured, using the scope attribute, to apply to a specified row or column, or to the not-yet-scoped cells within the current row group (that is, the same ancestor {{HTMLElement("thead")}}, {{HTMLElement("tbody")}}, or {{HTMLElement("tfoot")}} element). If no value is specified for scope, the header is not associated directly with cells in this way. Permitted values for scope are:
[!NOTE] This property doesn't have a visual effect in browsers. It adds semantic information to help assistive technology like screen readers to present the table in a more coherent way.
One of the following values:
col
colspan is used as well), until either the end of the column or another <th> in the column establishes a new scope.colgroup
row
rowspan is used as well), until either the end of the row or another <th> in the same row establishes a new scope.rowgroup
"")
This example adds a scope label to all the th numbers of the thead.
<table>
<caption>
Tallest Dams
</caption>
<thead>
<tr>
<td></td>
<th>Dam</th>
<th>Country</th>
<th>Height</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<th scope="row">Jinping-I Dam</th>
<td>China</td>
<td>305 m</td>
</tr>
<tr>
<td>2.</td>
<th scope="row">Nurek Dam</th>
<td>Tajikistan</td>
<td>300 m</td>
</tr>
<tr>
<td>3.</td>
<th scope="row">Lianghekou Dam</th>
<td>China</td>
<td>295 m</td>
</tr>
<tr>
<td>4.</td>
<th scope="row">Xiowan Dam</th>
<td>China</td>
<td>292 m</td>
</tr>
<tr>
<td>5.</td>
<th scope="row">Balhetan Dam</th>
<td>China</td>
<td>289 m</td>
</tr>
<tr>
<td>6.</td>
<th scope="row">Xiluodu Dam</th>
<td>China</td>
<td>285.5 m</td>
</tr>
<tr>
<td>7.</td>
<th scope="row">Grande-Dixence Dam</th>
<td>Switzerland</td>
<td>285 m</td>
</tr>
</tbody>
</table>
const thElements = document.querySelectorAll("thead th");
thElements.forEach((th) => {
th.scope = "col";
});
{{EmbedLiveSample("Examples", "100%", 220)}}
{{Specifications}}
{{Compat}}