HTML5 Guidelines for Web Developers

(coco) #1

34 Chapter 2—Structure and Semantics for Documents


Table 2.2 Usage of Semantic Text Elements (Contd.)
Element Purpose Example

code Computer code The <code>fruitdb</code> program can be used
for tracking fruit production.
var Variables If there are <var>n</var> fruit in the bowl, at
least <var>n</var>÷2 will be ripe.

samp Computer
output

The computer said <samp>Unknown error
-3</samp>.
kbd User input Hit <kbd>F1</kbd> to continue.

sub Subscripts Water is H<sub>2</sub>O.
sup Superscripts The hydrogen in heavy water is usually <sup>2
</sup>H.

i Alternative voice Lemonade consists primarily of <i>Citrus
limon</i>.
b Keywords Take a <b>lemon</b> and squeeze it with a
<b>juicer</b>.

mark Highlight Elderflower cordial, with one <mark>part</mark>
cordial to ten <mark>part</mark>s water, stands
a<mark>part</mark> from the rest.
ruby, rt,
rp

Ruby
annotations

<ruby> OJ <rp>(<rt>Orange Juice<rp>)</ruby>

bdi Text directional-
ity isolation

The recommended restaurant is <bdi lang="">
My Juice Café (At The Beach)</bdi>.
bdo Text directional-
ity formatting

The proposal is to write English but in
reverse order. “Juice” would become
“<bdo dir=rtl>Juice</bdo>»

span Other In French we call it <span
lang="fr">sirop de sureau</span>.
br Line break Simply Orange Juice Company<br>Apopka, FL
32703<br>U.S.A.

wbr Line breaking
opportunity

http://www.simply<wbr>orange<wbr>juice.com
Free download pdf