Template:Abbr/doc

Wikipedia uses two separate templates to generate tooltips. The abbr template is used to write an abbreviation (including an acronym or initialism) with its expanded meaning. It is a wrapper for the HTML element . The tooltip template uses the element to provide generic notes.

Only use or  to mark up abbreviations (including acronyms and initialisms). Using it to generate tooltips elsewhere is a misuse of the underlying HTML and causes accessibility problems. For general-purpose tooltips, use instead.

Readers on mobile devices typically do not have a mouse to hover with, and so generally cannot see tooltip contents. As of 2023, more English Wikipedia page views occur on mobile than on desktop browsers.|bar|2-year|access~desktop*mobile-app*mobile-web|monthly

Parameters
Two unnamed (positional) parameters (required) and three named parameters (optional):


 * 1 – the term to be explained; displays as text. Wiki markup is allowed but works more consistently when wrapping the template, see below for linking examples.
 * 2 – the tooltip/pop-up (no wiki or html markup allowed). The popup is created by an HTML  attribute, so it cannot contain HTML (or markup that resolves to HTML when rendered). This includes simple things like.
 * class – one or more CSS classes (space-separated if more than one)
 * id – an HTML id must be unique on the entire page.
 * style –  CSS to apply to the displayed text (no effect on tooltip/popup). Any style values with embedded blanks must be single-quoted, e.g. font-family: 'Times New Roman', serif;

Examples
When hovering over the text "LSD", something like Louisiana School for the Deaf will appear as a tooltip in desktop browsers. Mobile devices may display a dotted line or other visual indicator of abbreviation, but will not provide the tooltip. No screen readers for the visually impaired will read the expansion by default; some provide an optional setting to read the expansion aloud.

Abbr examples
In the above example, each abbreviation is first expanded in the body text within parentheses. The template provides an additional way for some users to access the meaning later in the text. See MOS:ABBR for more information.

In the above example, all abbreviations are expanded via the template. This is discouraged because it is the only way for users to access the meaning. Users reading on a mobile device, reading a printout, or listening to a screen reader will likely not have access to the full meaning.

In the above example, all abbreviations are expanded via the template, and an entire sentence is embedded via the template. It is the only way for users to access the meaning. A user reading on a mobile device, reading a printout, or listening to a screen reader will likely not have access to the full meaning of the abbreviation and will have no clear indication that the embedded footnote exists.

Tooltip example
Tooltips should not be used within the body text of an article if possible (see MOS:NOTOOLTIPS). Generic tooltip notes are not a substitute for footnotes and are intended to be used for navigational and other secondary features where space is limited. See Template:Glossary link or Template:Cite book/doc for practical examples.

Linking
To wiki-link the abbreviation being marked up by this template, wrap the template in the link, or the tooltip will not appear in some browsers.

Accessibility and validity
The Abbr template is intended for use with abbreviations (including acronyms and initialisms).

The Web Content Accessibility Guidelines contain guidelines for using the element generated by this template; see section H28: Providing definitions for abbreviations by using the abbr and acronym elements. HTML specifications (both those of the W3C and WHATWG) strictly define the element as reserved for markup of abbreviations. Abusing it for mouse-over tooltips breaks our semantic markup and makes our content (it will falsely pass a basic automated validator test because such a tool can't tell that the logical application of the data to the structure isn't correct, only that tags are nested properly).

Redirects
The following template names will redirect to Abbr:
 * Abbrv
 * Define

Tooltip is a separate template sharing the same documentation.