Open In App

HTML abbr Attribute

The abbr attribute is used to specify the shorter version or abbreviation of the content. It does not describe any visual effect but it is used by screen readers.

Usage: It is used in <th> and <td> tag.



abbr attribute in <th> tag:

Syntax:



<th abbr="text">

 

Attribute values:

Example 1: The following code shows how to use the abbr attribute in the header cell.




<!DOCTYPE html>
<html>
  
<body>
    <h1 style="color:green">GeeksforGeeks</h1>
  
    <h2>HTML th abbr attribute</h2>
  
    <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>BITTU</td>
            <td>22</td>
            <td>CSE</td>
        </tr>
  
        <tr>
            <td>RAKESH</td>
            <td>25</td>
            <td>EC</td>
        </tr>
    </table>
</body>
</html>

Output:                      

abbr attribute in <td> tag:

Syntax:

<td abbr="text">

Attribute values:

Example 2: The following code shows how to use the abbr attribute in the column cell.




<!DOCTYPE html>
<html>
  
  
<body>
    <h1 style="color:green">GeeksforGeeks</h1>
  
    <h2>HTML td abbr attribute</h2>
  
    <table border="1">
        <tr>
            <th>NAME</th>
            <th>AGE</th>
            <th>BRANCH</th>
        </tr>
  
        <tr>
            <td abbr="name of student">BITTU</td>
            <td abbr="age of student">22</td>
            <td abbr="branch name">CSE</td>
        </tr>
  
        <tr>
            <td>RAKESH</td>
            <td>25</td>
            <td>EC</td>
        </tr>
    </table>
</body>
  
</html>

Output:                   

Supported Browsers: The browser supported by HTML abbr attribute are listed below.


Article Tags :