Difference between revisions of "Template:abbr"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<abbr {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|&quot;}}}}">{{{1|}}}</abbr><noinclude>
+
<abbr {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{{2|}}}}}">{{{1|}}}</abbr><noinclude>
  
 
The {{tl|abbr}} template is used to write an abbreviation (including an acronym or initialism) with its expanded meaning. It is a wrapper for the {{w|HTML}} {{w|HTML element#General phrase elements|element}} abbr.
 
The {{tl|abbr}} template is used to write an abbreviation (including an acronym or initialism) with its expanded meaning. It is a wrapper for the {{w|HTML}} {{w|HTML element#General phrase elements|element}} abbr.
Line 6: Line 6:
  
 
== Usage ==
 
== Usage ==
<nowiki>{{abbr|text to display inline in the article|pop-up tip}}</nowiki>
+
<nowiki>{{abbr|text to display inline in the article|pop-up tip}}</nowiki>
  
 
== Parameters ==
 
== Parameters ==
Line 18: Line 18:
 
* style –  CSS to apply to the displayed text (no effect on tooltip/popup). Any style values with embedded blanks must be single-quoted
 
* style –  CSS to apply to the displayed text (no effect on tooltip/popup). Any style values with embedded blanks must be single-quoted
  
<nowiki>{{abbr|LSD|Louisiana School for the Deaf}}
+
<nowiki>{{abbr|LSD|Louisiana School for the Deaf}}</nowiki>
</nowiki>
 
becomes
 
  
{{abbr|LSD|Louisiana School for the Deaf}}
+
:becomes
 +
 
 +
:{{abbr|LSD|Louisiana School for the Deaf}}
  
 
When hovering over the text "{{abbr|LSD|Louisiana School for the Deaf}}", something like <span class="titlehint" style="border: 1px solid black; background-color: #FFFFFF; margin-right: 2px; padding: 1px 2px; font-size: smaller; box-shadow: 2px 2px 3px #A0A0A0;">Louisiana School for the Deaf</span> 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.
 
When hovering over the text "{{abbr|LSD|Louisiana School for the Deaf}}", something like <span class="titlehint" style="border: 1px solid black; background-color: #FFFFFF; margin-right: 2px; padding: 1px 2px; font-size: smaller; box-shadow: 2px 2px 3px #A0A0A0;">Louisiana School for the Deaf</span> 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.
  
 
{{w|Template:Abbr|See full documentation.}}
 
{{w|Template:Abbr|See full documentation.}}
 +
[[Category: Templates]]

Latest revision as of 19:40, 17 June 2025

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.

Readers on mobile devices typically do not have a mouse to hover with, and so generally cannot see tooltip contents.

Usage[edit]

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

Parameters[edit]

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
{{abbr|LSD|Louisiana School for the Deaf}}
becomes
LSD

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.

See full documentation.