Template:Tooltip
This template uses TemplateStyles: |
The {{Tooltip}}
template uses the <span>...</span>
HTML element to provide generic notes for normal text. Please be mindful that visitors on mobile devices typically do not have a mouse to hover with, and so generally cannot see tooltip contents.
Usage[edit]
{{Tooltip|text to display inline on the page|pop-up tip}}
Parameters[edit]
This template has two (2) unnamed or positional parameters that must be defined, along with three (3) other named parameters that are optional:
Parameter | Value |
---|---|
Required parameters | |
|1= (or first unnamed parameter) |
The normal text to be annotated. Wiki markup is allowed, but works more consistently when wrapping the template (see linking examples below). |
|2= (or second unnamed parameter) |
The tooltip/hover text; no wiki or HTML markup allowed. The popup is created by an HTML title= attribute added to a <span>...</span> element, so it cannot contain HTML (or markup that resolves to HTML when rendered). This includes simple things like ''italics'' .
|
Optional parameters | |
|class=
|
One or more CSS classes (space-delimited, if more than one). |
|id=
|
An HTML id attribute value (must be unique on the entire page). |
|style=
|
CSS properties to apply to the displayed text (has no effect on tooltip/pop-up), each terminated with a semicolon. Any style values with embedded whitespace must be single-quoted, e.g. style=font-family: 'Times New Roman', serif; .
|
Examples[edit]
Markup | Renders as |
---|---|
{{Tooltip|LSD|Louisiana School for the Deaf}} |
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.
Markup | Renders as |
---|---|
[[wikipedia:Wikipedia:COI|{{Tooltip|Conflict of interest|in the specific sense employed in Wikimedia policy}}]] |
Conflict of interest |
Tooltips should not be used within the body text of an page, if possible. 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[edit]
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 |
|
TKO |
Less compatible |
|
TKO |
TemplateData[edit]
Tooltip
Generic tooltip displayed on mouse-over.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Term | 1 | Shows as text | String | required |
Tooltip | 2 | Shows as a mouse-over tooltip; do not use markup | String | required |
CSS | style | applies the specified CSS directives to the content of parameter 1 | Line | optional |
Class | class | Adds a one or more CSS classes | Line | optional |
ID | id | Adds an HTML id (must be unique in the page) | Line | optional |
The above documentation is transcluded from Template:Tooltip/doc (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Please add categories to the /doc subpage. Subpages of this template. |