Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Template:Abbr/sandbox

From Wikipedia, the free encyclopedia
<Template:Abbr

This is thetemplate sandbox page forTemplate:Abbr (diff).
See also the companion subpage fortest cases.
For inline cleanup templates requesting definitions or explanations, see{{Definition}} and{{Explain}}.
This template can only be edited byadministrators because it istranscluded onto one or morecascade-protected pages.
iconThis templateshould not be used incitation templates such asCitation Style 1 andCitation Style 2, because it includes markup that will pollute theCOinS metadata they produce; seeWikipedia:COinS.
This template doesnot display in the mobile view of Wikipedia; it isdesktop only. SeeTemplate:Navbox visibility for a brief explanation.
WarningThis template is used onapproximately 941,000 pages, or roughly 1% of all pages.
To avoid major disruption and server load, any changes should be tested in the template's/sandbox or/testcases subpages, or in your ownuser subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
This template is used by one or morebots.
If you intend to change this template in any significant way, move it, or nominate it for deletion, please inform the bot operators. Thank you. The relevant bots are:User:AAlertBot


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 theHTMLelement<abbr>...</abbr>. The{{tooltip}} template uses the<span>...</span> element to provide generic notes.

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 causesaccessibility problems. For general-purpose tooltips, use{{tooltip}} instead.

Readers onmobile 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

[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 HTMLtitle= 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

[edit]
MarkupRenders as
{{abbr|LSD|Louisiana School for the Deaf}}

When hovering over the text "LSD", something likeLouisiana 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, butwill 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.

Accessible when used in addition to inline expansion
MarkupRenders as
High school students staying overnight on the Louisiana School for the Deaf (LSD) campus can phone their parents using an American Sign Language (ASL) interpreter. Although fluent in {{abbr|ASL|American Sign Language}}, most students at {{abbr|LSD|Louisiana School for the Deaf}} prefer texting their parents directly.

High school students staying overnight on the Louisiana School for the Deaf (LSD) campus can phone their parents using an American Sign Language (ASL) interpreter. Although fluent inASL, most students atLSD prefer texting their parents directly.

In the above example, each abbreviation is first expanded in the body text within parentheses. The template provides anadditional way for some users to access the meaning later in the text. SeeMOS:ABBR for more information.

Less accessible when used in place of inline expansion
MarkupRenders as
High school students staying overnight on the {{abbr|LSD|Louisiana School for the Deaf}} campus can phone their parents using an {{abbr|ASL|American Sign Language}} interpreter. Although fluent in {{abbr|ASL|American Sign Language}}, most students at {{abbr|LSD|Louisiana School for the Deaf}} prefer texting their parents directly.

In the above example, all abbreviations are expanded via the template. This is discouraged because it is theonly 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.

Least accessible whenmisused to create tooltip notes
MarkupRenders as
High school students staying overnight on the {{abbr|LSD|Louisiana School for the Deaf}} campus can phone their parents using an {{abbr|ASL|American Sign Language}} {{abbr|interpreter|Although fluent in ASL, most students at LSD prefer texting their parents directly.}}.

High school students staying overnight on theLSD campus can phone their parents using anASLinterpreter.

In the above example, all abbreviations are expanded via the template, and an entire sentence is embedded via the template. It is theonly 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

[edit]
MarkupRenders as
[[WP:COI|{{tooltip|conflict of interest|in the specific sense employed in Wikipedia policy}}]]

Tooltips should not be used within the body text of an article if possible (seeMOS:NOTOOLTIPS). Generic tooltip notes are not a substitute forfootnotes and are intended to be used for navigational and other secondary features where space is limited. SeeTemplate:Glossary link orTemplate:Cite book/doc#Usage for practical examples.

Linking

[edit]
Preferably use{{Abbrlink}} instead.

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.

CompatibilityMarkupRenders as
Compatible[[Knockout#Technical knockout|{{abbr|TKO|technical knockout}}]]TKO
Less compatible{{abbr|[[Knockout#Technical knockout|TKO]]|technical knockout}}TKO

Accessibility and validity

[edit]

The{{Abbr}} template is intendedonly for use with abbreviations (including acronyms and initialisms).

TheWeb Content Accessibility Guidelines contain guidelines for using the<abbr> element generated by this template; see sectionH28: Providing definitions for abbreviations by using the abbr and acronym elements. HTML specifications (both those of theW3C andWHATWG) strictly define the<abbr> element as reserved for markup of abbreviations. Abusing it for mouse-over tooltips breaks oursemantic markup and makes our contentinvalid HTML (it will falsely pass a basicautomated 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

[edit]

The following template names willredirect to{{Abbr}}:

{{Tooltip}} is a separate template sharing the same documentation.

Maintenance categories

[edit]

Template data

[edit]
This is theTemplateData for this template used byTemplateWizard,VisualEditor and other tools.See a monthly parameter usage report forTemplate:Abbr in articles based on its TemplateData.

TemplateData for Abbr


See also

[edit]
  • {{Abbrlink}}, a variant of this template that includes automatic wikilinking of the term (abbreviation).
  • {{dfn}}
The abovedocumentation istranscluded fromTemplate:Abbr/doc.(edit |history)
Editors can experiment in this template'ssandbox(edit |diff) andtestcases(edit) pages.
Add categories to the/doc subpage.Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Abbr/sandbox&oldid=1101835367"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp