HTML Abbreviations and Acronyms (Live Playground)
Abbreviations and acronyms are commonly used in web content to simplify and condense information. In this tutorial, you will learn how to use the
<abbr> element in HTML to mark up abbreviations and acronyms, making your web content more accessible for users and screen readers.
<abbr> element is used to indicate that a word or phrase is an abbreviation or acronym. By using the title attribute with the
<abbr> element, you can provide the full, expanded version of the abbreviation or acronym. This makes it easier for screen readers and other assistive technologies to understand the meaning of the abbreviation or acronym. Here's an example of using the
<abbr> element with the title attribute:
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>
When a user hovers over the "WHO" abbreviation in this example, they will see a tooltip with the expanded version, "World Health Organization".
Styling Abbreviations and Acronyms
You can use CSS to style the appearance of abbreviations and acronyms marked with the
<abbr> element. For example, you can add a dotted underline to abbreviations to visually indicate that they have additional information. To do this, add the following CSS rule to your stylesheet:
text-decoration: underline dotted;
cursor: help; property changes the mouse cursor to a question mark when hovering over the abbreviation, signaling that more information is available.
<abbr> element with the
title attribute is an important aspect of web accessibility, ensuring that users and screen readers can understand the meaning of abbreviations and acronyms. In this tutorial, you learned how to use the
<abbr> element to mark up abbreviations and acronyms in your HTML content, and how to style them using CSS.