Template:Em/doc: Difference between revisions

From Unofficial Homecoming Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
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==

Latest revision as of 03:04, 8 December 2024

This is a documentation subpage for Template:Em (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.


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; adds style="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; adds id="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); adds class="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