The abbr attribute of the <th> tag specifies an abbreviated version of the header cell content. It helps provide a shorter label for use in contexts like screen readers or when displaying compact tables.
- Defines an abbreviation for header content.
- Improves accessibility for screen readers.
- Useful in compact or complex tables (used only with <th> element).
Syntax:
<th abbr="text">Attribute Values:
- text: It contains the short description of header cell content.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>HTML th abbr Attribute</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML th abbr Attribute</h2>
<!--Driver Code Ends-->
<table border="1">
<tr>
<th abbr="name of student">NAME</th>
<th abbr="age of student">AGE</th>
<th abbr="branch name">BRANCH</th>
</tr>
<tr>
<td>Ben</td>
<td>22</td>
<td>CSE</td>
</tr>
<tr>
<td>Ron</td>
<td>25</td>
<td>EC</td>
</tr>
</table>
<!--Driver Code Starts-->
</body>
</html>
<!--Driver Code Ends-->