Posts in current category

HTML5 <em> <strong> <dfn> <code> <samp> <kbd> <var> <cite> tag


May 03, 2021 13:20 HTML5


Table of contents


a reference to a work. Definitions and usages

The following elements are phrase elements. They are not opposed to use, but they may yield richer results by using style sheets.

<em> Rendered as highlighted text.
<strong> Define important text.
<dfn> Define a defined item.
<code> Define the computer code text.
<samp> Define the sample text.
<kbd> Define the keyboard text. I t indicates that the text was typed from the keyboard. It is often used in computer-related documents or manuals.
<var> Define variables. You can use this label with the hashtags .
<cite> Define the reference. You can use this label to define references to references, such as titles for books or magazines.

The difference between HTML 4.01 and HTML 5

In HTML 4.01, the tone of the definition is heavier than the emphasis text, but in HTML 5, the important text is defined.

Example

<em> indicate an implicit or explicit comparison.

<p>
  In HTML 5, what was previously called <em>block-level</em> content is now called <em>flow</em> content.
</p>

Example

<strong> and is generally displayed in bold.

<p>When doing x it is <strong>imperative</strong> to do y before proceeding.</p>

Instructions for use:

  • The elements are marked with defined terms; the term definition should be given in the list of definitions (usually .

    The value of a defined term is determined by the following rules: If the element has a title property, the value of the term is the value of that property. O therwise, if it contains only one element, which has a title property, the value of the term is the value of that property. Otherwise, the text content of the element is the value of the term.

Example

HTML <code> piece of computer code. B y default, it is displayed in the browser's default iso-wide font.

<p>Regular text. <code>This is code.</code> Regular text.</p>

Example

The element is used to identify the output of a computer program, typically using the browser's default monotype font

<p>Regular text. <samp>This is sample text.</samp> Regular text.</p>

Example

Used to represent user input, it produces an in-line element that appears in the browser's default monospace font.

<p>Type the following in the Run dialog: <kbd>cmd</kbd><br />Then click the OK button.</p>

<p>Save the document by pressing <kbd>Ctrl</kbd> + <kbd>S</kbd></p>

Example

The label represents the name of the variable, or the value provided by the user.

<p> A simple equation: <var>x</var> = <var>y</var> + 2 </p>

Example

a reference to a work.

More information can be found in <cite>[ISO-0000]</cite>.

Property

The standard property

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, 
lang, ref, registrationmark, tabindex, template, title

The event property

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, 
ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, 
ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, 
onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, 
onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload