HTML scope Attribute

HTML scope Attribute: This attribute defines whether a header cell is a header for a column, row, or group of columns or rows.

HTML scope Attribute

This attribute can be applied on <th> element.

Syntax: <th scope =”col|row|colgroup|rowgroup”>content</th>



Browser Support

This attribute is supported by the following browsers:

  • Chrome
  • Firefox
  • Internet Explorer
  • Opera
  • Safari

Example: for <th> element

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>

<table>
  <tr>
    <th>Book name</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>C</td>
    <td>$120</td>
  </tr>
  <tr>
    <td>JAVA</td>
    <td>$80</td>
  </tr>
</table>

</body>
</html>

Output:

HTML scope attribute