HTML scope attribute
scope
The purpose of the HTML scope attribute is to specify the scope for header cells of a table.
Supported elements
HTML scope attribute supports td and th elements.
Syntax
<ElementName scope="value" >.....</ElementName>
Where ElementName is any supported element.
Type of value
Scope.
Value
Value | Description |
---|---|
col | Defines that the associated cell is a header for a column. |
row | Defines that the associated cell is a header for a row. |
colgroup | Defines that the associated cell is a header for a column group. |
rowgroup | Defines that the associated cell is a header for a row group. |
Default value
There is not default value of HTML scope attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML scope attribute with th element
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML scope attribute with th element</title>
</head>
<body>
<table width="200" border="1" cellpadding="2">
<tr>
<th scope="col">Student Code </th>
<th scope="col">Percentage of marks</th>
<th scope="col">Grade</th>
<th scope="col">Remarks</th>
<tr>
</tr>
<td>S001</td>
<td>92</td>
<td>A+</td>
<td>Excellent</td>
<tr>
</tr>
<td>S002</td>
<td>76</td>
<td>B+</td>
<td>Good</td>
</tr>
</table>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML scope attribute with th element
Example of HTML scope attribute with td element
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML scope attribute with td element</title>
</head>
<body>
<table width="200" border="1" cellpadding="2">
<tr>
<td scope="row">Student Code</td>
<td scope="row">Percentage of marks</td>
<td scope="row">Grade</td>
<td scope="row">Remarks</td>
</tr>
<tr>
<td>S001</td>
<td>92</td>
<td>A+</td>
<td>Excellent</td>
</tr>
<tr>
<td>S002</td>
<td>76</td>
<td>B+</td>
<td>Good</td>
</tr>
</table>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML scope attribute with td element
Previous: HTML scheme attribute
Next: HTML scrolling attribute
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics