summaryrefslogtreecommitdiff
path: root/devdocs/html/element%2Fem.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/html/element%2Fem.html
new repository
Diffstat (limited to 'devdocs/html/element%2Fem.html')
-rw-r--r--devdocs/html/element%2Fem.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fem.html b/devdocs/html/element%2Fem.html
new file mode 100644
index 00000000..c96cbf80
--- /dev/null
+++ b/devdocs/html/element%2Fem.html
@@ -0,0 +1,84 @@
+<header><h1>&lt;em&gt;: The Emphasis element</h1></header><div class="section-content"><p>The <code>&lt;em&gt;</code> <a href="../index">HTML</a> element marks text that has stress emphasis. The <code>&lt;em&gt;</code> element can be nested, with each level of nesting indicating a greater degree of emphasis.</p></div>
+<h2 id="try_it">Try it</h2>
+<div class="section-content"><iframe class="interactive is-tabbed-shorter-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/em.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe></div>
+<h2 id="attributes">Attributes</h2>
+<div class="section-content"><p>This element only includes the <a href="../global_attributes">global attributes</a>.</p></div>
+<h2 id="usage_notes">Usage notes</h2>
+<div class="section-content">
+<p>The <code>&lt;em&gt;</code> element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself.</p> <p>Typically this element is displayed in italic type. However, it should not be used to apply italic styling; use the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-style"><code>font-style</code></a> property for that purpose. Use the <a href="cite"><code>&lt;cite&gt;</code></a> element to mark the title of a work (book, play, song, etc.). Use the <a href="i"><code>&lt;i&gt;</code></a> element to mark text that is in an alternate tone or mood, which covers many common situations for italics such as scientific names or words in other languages. Use the <a href="strong"><code>&lt;strong&gt;</code></a> element to mark text that has greater importance than surrounding text.</p>
+</div>
+<h3 id="i_vs._em">&lt;i&gt; vs. &lt;em&gt;</h3>
+<div class="section-content">
+<p>Some developers may be confused by how multiple elements seemingly produce similar visual results. <code>&lt;em&gt;</code> and <code>&lt;i&gt;</code> are a common example, since they both italicize text. What's the difference? Which should you use?</p> <p>By default, the visual result is the same. However, the semantic meaning is different. The <code>&lt;em&gt;</code> element represents stress emphasis of its contents, while the <code>&lt;i&gt;</code> element represents text that is set off from the normal prose, such as a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use <code>&lt;cite&gt;</code>.)</p> <p>This means the right one to use depends on the situation. Neither is for purely decorative purposes, that's what CSS styling is for.</p> <p>An example for <code>&lt;em&gt;</code> could be: "Just <em>do</em> it already!", or: "We <em>had</em> to do something about it". A person or software reading the text would pronounce the words in italics with an emphasis, using verbal stress.</p> <p>An example for <code>&lt;i&gt;</code> could be: "The <em>Queen Mary</em> sailed last night". Here, there is no added emphasis or importance on the word "Queen Mary". It is merely indicated that the object in question is not a queen named Mary, but a ship named <em>Queen Mary</em>. Another example for <code>&lt;i&gt;</code> could be: "The word <em>the</em> is an article".</p>
+</div>
+<h2 id="examples">Examples</h2>
+<div class="section-content">
+<p>In this example, the <code>&lt;em&gt;</code> element is used to highlight an implicit or explicit contrast between two ingredient lists:</p> <div class="code-example">
+<p class="example-header"><span class="language-name">html</span></p>
+<pre data-signature="UXf1xt3uyeRdmREApaSKk1UzFYim5tpPfITzH0C3tD4=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>
+ Ice cream is made with milk, sweetener, and cream. Frozen custard, on the
+ other hand, is made of milk, cream, sweetener, and <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>em</span><span class="token punctuation">&gt;</span></span>egg yolks<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>em</span><span class="token punctuation">&gt;</span></span>.
+<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>
+</pre>
+</div>
+</div>
+<h3 id="result">Result</h3>
+<div class="section-content"><div class="code-example" id="sect1">
+
+<iframe class="sample-code-frame" title="Examples" id="frame_example" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/em/runner.html?id=example" loading="lazy"></iframe>
+</div></div>
+<h2 id="technical_summary">Technical summary</h2>
+<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td> <a href="../content_categories#flow_content">Flow content</a>, <a href="../content_categories#phrasing_content">phrasing content</a>, palpable content. </td> </tr> <tr> <th scope="row">Permitted content</th> <td>
+<a href="../content_categories#phrasing_content">Phrasing content</a>.</td> </tr> <tr> <th scope="row">Tag omission</th> <td>None, both the starting and ending tag are mandatory.</td> </tr> <tr> <th scope="row">Permitted parents</th> <td> Any element that accepts <a href="../content_categories#phrasing_content">phrasing content</a>. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td><code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles#structural_roles_with_html_equivalents">emphasis</a></code></td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td>Any</td> </tr> <tr> <th scope="row">DOM interface</th> <td> <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement"><code>HTMLElement</code></a> Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLSpanElement"><code>HTMLSpanElement</code></a> interface for this element. </td> </tr> </tbody> </table></div></figure></div>
+<h2 id="specifications">Specifications</h2>
+<div class="_table"><table class="standard-table">
+<thead><tr><th scope="col">Specification</th></tr></thead>
+<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element">HTML Standard <br><small># the-em-element</small></a></td></tr></tbody>
+</table></div>
+<h2 id="browser_compatibility">Browser compatibility</h2>
+<div class="_table"><table>
+<thead>
+<tr id="bct-browser-type">
+<th></th>
+<th colspan="6">Desktop</th>
+<th colspan="6">Mobile</th>
+</tr>
+<tr id="bct-browsers">
+<th></th>
+<th>Chrome</th>
+<th>Edge</th>
+<th>Firefox</th>
+<th>Internet Explorer</th>
+<th>Opera</th>
+<th>Safari</th>
+<th>WebView Android</th>
+<th>Chrome Android</th>
+<th>Firefox for Android</th>
+<th>Opera Android</th>
+<th>Safari on IOS</th>
+<th>Samsung Internet</th>
+</tr>
+</thead>
+<tbody><tr>
+<th><code>em</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">15</td>
+<td class="bc-supports-yes">≤4</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">≤3.2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr></tbody>
+</table></div>
+<h2 id="see_also">See also</h2>
+<div class="section-content"><ul> <li><a href="i"><code>&lt;i&gt;</code></a></li> </ul></div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2005&ndash;2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br>
+ <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em</a>
+ </p>
+</div>