Template:Abbr/doc

From PathfinderWiki
Smallwikipedialogo.png

This page uses content from Wikipedia. The original article was at Template:Abbr/doc. The list of authors can be seen in the page history. The text of Wikipedia is available under the Creative Commons Attribution-ShareAlike License.

PathfinderWiki 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 <abbr>.

Only use {{abbr}} or <abbr> 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.

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.[1]

Usage

{{abbr|text to display inline in the article|pop-up tip}}

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 title= attribute, so it cannot contain HTML (or markup that resolves to HTML when rendered). This includes simple things like ''italics''.
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. style=font-family: 'Times New Roman', serif;

Examples

{{abbr|Ref.|References}}

When hovering over the text "Ref.", something like References 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.

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.

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.

Compatibility Markup Renders as
Compatible [[Project:The Mwangi Expanse Inclusion Initiative|{{abbr|MEII|Mwangi Expanse Inclusion Initiative}}]] MEII
Less compatible {{abbr|[[Project:The Mwangi Expanse Inclusion Initiative|MEII]]|Mwangi Expanse Inclusion Initiative}} MEII

Accessibility and validity

{{Abbr}} is intended only for use with abbreviations (including acronyms and initialisms).

The Web Content Accessibility Guidelines contain guidelines for using the <abbr> element generated by this template; see section H28: Providing definitions for abbreviations by using the abbr and acronym elements. HTML specifications strictly define the <abbr> element as reserved for markup of abbreviations. Abusing it for mouse-over tooltips breaks our semantic markup and makes our content invalid HTML.