HTML abbr attribute
abbr
The pPurpose of the HTML abbr attribute is to specify the abbreviation for a table header cell.
Supported elements
HTML abbr attribute supports td and th.
Syntax
<td abbr="value" >.....</td>
<th abbr="value" >.....</th>
Type of value
Type of value of HTML abbr attribute is text.
Value
A string / text which sets the abbreviated text.
Default value
There is no default value of HTML abbr attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML abbr attribute with td
<!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>abbr td example</title>
</head>
<body>
<table>
<tr>
<td abbr="United Kingdom">UK</td>
<td>Capital is London.</td>
</tr>
<tr>
<td abbr="United States of America">USA</td>
<td>Capital is Washington, D.C.</td>
</tr>
</table>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML abbr attribute with td.
Example of HTML abbr attribute with th
<!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>Untitled Document</title>
</head>
<body>
<table border="1px" >
<tr>
<th abbr="State">Country</th>
<th abbr="Capital">Capital of the state</th>
</tr>
<tr>
<td abbr="United Kingdom">UK</td>
<td>Capital is London.</td>
</tr>
<tr>
<td abbr="United States of America">USA</td>
<td>Capital is Washington, D.C.</td>
</tr>
</table>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML abbr attribute with th.
Previous: What is an HTML attribute
Next: HTML accept-charset attribute
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/attributes/html-abbr-attribute.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics