Template:Tooltip: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
HyperNervie (talk | contribs) (Escape markups in tooltip; Add documentation) |
||
| Line 1: | Line 1: | ||
<span class="tooltip" title="{{{2}}}" style="text-decoration: underline; text-decoration-style: dotted">{{{1}}}</span><noinclude> | <includeonly><span class="tooltip" title="{{#tag:nowiki|{{{2}}}}}" style="text-decoration: underline; text-decoration-style: dotted">{{{1}}}</span></includeonly><noinclude>{{Documentation|content= | ||
This template adds a dotted underline and a tooltip (passed as {{param|2}}) to a piece of text (passed as {{param|1}}). On desktop view, the tooltip shows when cursor hovers on the text. On mobile view, tapping on the text changes itself to the tooltip; tapping again changes it back to the original text. | |||
Any Wikitext and HTML markups (e.g. <code><nowiki>''italic''</nowiki></code>, <code><br></code>) in tooltip are escaped. To insert newlines, use the [[wikipedia:Character entity|character entity reference]] <code>&#10;</code>, <code>&#xA;</code>, <code>&#xa;</code> or <code>&NewLine;</code>. | |||
Examples: | |||
* <code><nowiki>{{tt|Text|Tooltip}}</nowiki></code> → {{tt|Text|Tooltip}} | |||
* <code><nowiki>{{tt|Text|Tool<br>Tip}}</nowiki></code> → {{tt|Text|Tool<br>tip}} | |||
* <code><nowiki>{{tt|Text|Tool&#10;Tip}}</nowiki></code> → {{tt|Text|Tool Tip}} | |||
}}[[Category:Formatting templates]]</noinclude> | |||
Revision as of 01:13, 11 August 2025
This template adds a dotted underline and a tooltip (passed as {{{2}}}) to a piece of text (passed as {{{1}}}). On desktop view, the tooltip shows when cursor hovers on the text. On mobile view, tapping on the text changes itself to the tooltip; tapping again changes it back to the original text.
Any Wikitext and HTML markups (e.g. ''italic'', <br>) in tooltip are escaped. To insert newlines, use the character entity reference , 
, 
 or 
.
Examples:
{{tt|Text|Tooltip}}→ Text{{tt|Text|Tool<br>Tip}}→ Text{{tt|Text|Tool Tip}}→ Text