Template:Abbr/doc

From LNF Wiki
Jump to navigation Jump to search
For inline cleanup templates requesting definitions or explanations, see {{Definition}} and {{Elucidate}}.

The template {{Abbr}} is used to write an abbreviation with its meaning. It is a front-end for the HTML element <abbr>...</abbr>, the element used by most web browsers to create a tooltip indicating the meaning of an abbreviation or acronym.

Please note: Do not use {{abbr}} or <abbr> to mark up material other than abbreviations or acronyms. Using it to generate tooltips elsewhere is a misuse of the underlying HTML and causes accessibility problems.

Usage

The template {{abbr}} takes two unnamed parameters, in order:

  • abbreviation: The abbreviation; shows as text.
  • meaning: The meaning; shows as the tooltip.

A third unnamed parameter accepts the following values:

Named parameters:

  • class: Adds a CSS class.
  • id: Adds a HTML id; this must be unique on the entire page.
  • style: Adds a style attribute.

Examples

Markup Renders as
{{abbr|MSLP|Mean Sea Level Pressure}}

MSLP

When hovering over the text "MSLP", something like Mean Sea Level Pressure will appear as a tooltip in most browsers. Popular screen readers, used by visually impaired readers, give the meaning in a different way.

Markup Renders as
{{abbr|UK|United Kingdom|class=country-name|id=foobar}}

UK

Accessibility concerns

This template is intended for use with abbreviations; it is not intended to be a tool for generating tooltips. 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.

Redirects

The following template names will redirect to {{abbr}}:

Template data

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Abbr

<TemplateData> {

       "description": "This template defines an abbreviation or acronym, by creating a tooltip that is displayed on mouse-over.",
       "params": {
               "1": {
                       "label": "Abbreviation",
                       "description": "Shows as text",
                       "type": "string/line",
                       "required": true
               },
               "2": {
                       "label": "Meaning",
                       "description": "Shows as a tooltip",
                       "type": "string",
                       "required": true
               },
               "IPA": {
                       "label": "IPA",
                       "description": "Applies {{{1}}} to fix strings in the International Phonetic Alphabet rendered in Internet Explorer on Windows XP",
                       "type": "string/line",
                       "required": false
               },
               "unicode": {
                       "label": "Unicode",
                       "description": "Applies {{{1}}} to fix strings in Unicode rendered in Internet Explorer on Windows XP",
                       "type": "string/line",
                       "required": false
               },
               "class": {
                       "label": "Class",
                       "description": "Adds a HTML class",
                       "type": "string/line",
                       "required": false
               },
               "id": {
                       "label": "ID",
                       "description": "Adds a HTML id",
                       "type": "string/line",
                       "required": false
               }
       }

} </TemplateData>

See also

  • {{abbrlink}}, a variant of this template that includes wikilinking.
  • {{H:title}}, used for generating tooltips in general.
  • {{R-phrase}}, which generates the abbreviation (the code number) for a R-phrase (a "risk phrase", e.g. "Explosive when dry"). The R-phrase itself and a link to List of R-phrases are included in a tooltip.
  • {{clarify}}, which produces the inline superscript: [clarification needed].