Highlighting

Level: 2

With character highlighting elements you can format sections to provide emphasis by designating an information type (such as a variable) or by using character formatting. Highlighting tags may be ignored by minimal implementations.

In-line character tagging falls left to right in the rendered flow of text. The tags do not cause a paragraph break, and may be used on sections of text within paragraphs. Whitespace between the opening and closing tags separates words.

All character highlighting elements have related closing tags and use this format:

This is <em>emphasized</em> text.

Level 1 implementations must render highlighted text distinctly from plain text. Additionally, em content must be rendered as distinct from strong content, and b content must rendered as distinct from i content.

Highlighting elements are allowed within the content of other highlighting elements, but implementations are not required to render these nested highlighting elements distinctly from non-nested elements. For example, implementations may render these two cases identically:

plain <B>bold <I>italic</I></B>


plain <B>bold </B><I>italic</I>

Some character highlighting styles are more explicit than others about how they should be physically represented. Designate the information type rather than the character format wherever possible, unless for example it is necessary to refer to the formatting in the text as in "The italic parts are mandatory".

Information Type Elements

cite

The cite tag specifies a citation. Sections tagged with the cite style typically display in italics.

code

The code style indicates an example of code. typically monospaced font. (Do not confuse with <pre>).

dfn (proposed)

Proposed. The dfn tag indicates the defining instance of a term.

em

The em tag provides typographic emphasis, typically italics.

While em and i often give the same effect, use em except in the case that it is necessary to refer to the formatting in the text, as in "The italic parts are mandatory". This improves consistency between documents from various sources if, for example, a reader prefers to use color in stead of italics for emphasis.

kbd

The kbd style indicates text typed by a user. It might typically be used in an instruction manual.

samp

The samp type indicates a sequence of literal characters.

strike (proposed)

Proposed. The strike tag indicates "strike out" text, as in a legal document. This tag is not widely supported.

strong

The strong tag provides strong typographic emphasis, typically bold.

var

The var tag indicates a variable name.

Character Formatting Elements

b

The b tag specifies that the text be displayed in boldface, where available, otherwise alternative mapping is allowed.

i

The i tag specifies that the text be displayed in italic font (or slanted if italic unavailable).

tt

The tt tag specifies that the text be displayed in fixed-width typewriter font.

u (proposed)

Proposed. The u tag specifies that the text be displayed as underlined.

Example

This example shows how you might use highlighting elements in an HTML document:

This text contains an <em>emphasized</em> word.

<strong>Don't assume</strong> that it will be italic!
It was made with the <CODE>EM</CODE> element. A cite is
typically italic and has no formal necessary structure:
<cite>Moby Dick</cite> is a book title.

Preceding Section:
Headings
Following Section: Horizontal Rule
Parent Section: Body
Contents of HyperText Markup Language