Template:Em/doc: Difference between revisions
BlackSpectre (talk | contribs) (Created page with "{{Documentation subpage}} __NOTOC__ <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --> ==Usage== : <code><nowiki>{{em|text to be emphasized}}</nowiki></code> or, if the text to be emphasized contains an equals sign: : <code><nowiki>{{em|1=text to be emphasized}}</nowiki></code> These both render as: : {{em|1=text to be emphasized}} This template puts intentional and explicit <nowiki><em>...</em></nowiki> (emphasis) [X]HTML markup around the text...") |
BlackSpectre (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 28: | Line 28: | ||
* "<code><nowiki>Contrary to reports, she was {{em|not}} dead after all.</nowiki></code>"<br />"Contrary to reports, she was {{em|not}} dead after all." | * "<code><nowiki>Contrary to reports, she was {{em|not}} dead after all.</nowiki></code>"<br />"Contrary to reports, she was {{em|not}} dead after all." | ||
==Examples== | ==Examples== | ||
<code><nowiki>{{em| | <code><nowiki>{{em|italicize this text}}</nowiki></code> | ||
:: Renders as {{em| | :: Renders as {{em|italicize this text}} | ||
<code><nowiki>{{em|style=color:red|turn the color of the text red | <code><nowiki>{{em|style=color:red|italicize and turn the color of the text red}}</nowiki></code> | ||
:: Renders as {{em|style=color:red|turn the color of the text red | :: Renders as {{em|style=color:red|italicize and turn the color of the text red}} | ||
<code><nowiki>{{em|title=means to contemplate a question|Wondering}}</nowiki></code> | <code><nowiki>{{em|title=means to contemplate a question|Wondering}}</nowiki></code> | ||
:: Renders as {{em|title=means to contemplate a question|Wondering}} | :: Renders as {{em|title=means to contemplate a question|Wondering}} |
Latest revision as of 03:04, 8 December 2024
Usage
{{em|text to be emphasized}}
or, if the text to be emphasized contains an equals sign:
{{em|1=text to be emphasized}}
These both render as:
- text to be emphasized
This template puts intentional and explicit <em>...</em> (emphasis) [X]HTML markup around the text provided as the first parameter.
Optional parameters
Advanced HTML values can be passed through the template to the HTML code:
|style=
takes inline CSS input; addsstyle="CSS directive[s]"
to the HTML code|title=
takes text, which cannot be marked up in any way, and displays it as a pop-up "tooltip" (in most browsers) when the cursor hovers over the span|id=
takes a valid, unique HTML ID (must begin with an alphabetic letter) which you have defined on the page; addsid="name"
to the HTML code in order to format that element or create an in-page link.|class=
takes a class name (or multiple class names, separated by commas); addsclass="classname[s]"
to the HTML code
Use cases
This template is made to mildly emphasize an important word or phrase in a passage, in a way that is (unlike simply italicizing it) semantically meaningful markup. With this technique, the emphasized text stands out from the rest of the nearby text in most if not all visual browsers and some text-to-speech screen readers (which usually ignore purely typographic italicization), without strongly affecting scannability. It can also be parsed by user agents and other software as definitively indicating emphasis, not just some typographic boldface effect for appearance's sake. It should therefore only be used sparingly in articles, to highlight something being stressed (e.g., to represent strong vocal emphasis). Example:
- "
Contrary to reports, she was {{em|not}} dead after all.
"
"Contrary to reports, she was not dead after all."
Examples
{{em|italicize this text}}
- Renders as italicize this text
{{em|style=color:red|italicize and turn the color of the text red}}
- Renders as italicize and turn the color of the text red
{{em|title=means to contemplate a question|Wondering}}
- Renders as Wondering
{{em|id=myHTMLid|text to format}}
- Renders with the format or link you specified applied to the text
{em|class=myHTMLClassName|Text to format}
- Renders with the format you specified applied to the text