abbr
abbr attribute
The abbr
attribute in HTML is used to define a shortened version of an element's content. It's often applied to <th>
(table header) elements to offer a more concise description. This enhances accessibility, particularly for screen readers, by making the content easier to interpret.
Syntax
<th abbr="text">
Example
Percentage of Market Share |
---|
<table>
<tr>
<th abbr="PMS">Percentage of Market Share</th>
<!-- Other headers -->
</tr>
<!-- Table rows and cells -->
</table>
The abbr
attribute assists screen readers and other assistive technologies in interpreting table headers more effectively. By using abbreviations like "PMS" instead of the full "Percentage of Market Share," it makes it easier for users to navigate the data. This contributes to improving the accessibility and user-friendliness of web content.
Values
- text
- A brief text abbreviation for the
<th>
element.
- A brief text abbreviation for the
Applies To
The abbr
attribute can be applied to various HTML elements.
Example
Employee Name | Employee Role |
---|---|
John Doe | Marketing |
Jane Doe | Sales Manager |
<table border="1">
<tr>
<th attr="Name">Employee Name</th>
<th attr="Role">Employee Role</th>
</tr>
<tr>
<td>John Doe</td>
<td>Marketing</td>
</tr>
<tr>
<td>Jane Doe</td>
<td>Sales Manager</td>
</tr>
</table>
Conclusion
The abbr
attribute in HTML offers a way to provide a shortened version of the content in <th>
elements, enhancing accessibility for users, particularly those using screen readers. This helps simplify long table headers, making it easier for users to quickly understand and navigate the data presented in the table.
Input
HTML input attributes control how input elements behave, look, and validate data in forms, including defining types, default values, and limitations.
accept
The accept attribute in HTML specifies the allowed file types for <input> elements of type file, simplifying the process of filtering file selections for uploads.