8.5.Â In-line Elements

8.5.1.Â Emphasizing Information

Two levels of emphasis are available in
XHTML, em and
strong. em is for a
normal level of emphasis and strong
indicates stronger emphasis.

em is typically rendered in italic
and strong is rendered in bold. This is
not always the case, and should not be relied upon. According
to best practices, web pages only hold structural and
semantical information, and stylesheets are later applied to
them. Think of semantics, not formatting, when using these
tags.

ExampleÂ 8.12.Â em and
strong

Usage:

<p><em>This</em> has been emphasized, while
<strong>this</strong> has been strongly emphasized.</p>

8.5.2.Â Indicating Fixed-Pitch Text

Content that should be rendered in a fixed pitch
(typewriter) typeface is tagged with tt
(for “teletype”).

ExampleÂ 8.13.Â tt

Usage:

<p>Many system settings are stored in
<tt>/etc</tt>.</p>

8.5.3.Â Links

Note:

Links are also inline elements.

8.5.3.1.Â Linking to Other Documents on the Web

A link points to the URL of a
document on the web. The link is indicated with
a, and the
href attribute contains
the URL of the target document. The
content of the element becomes the link, indicated to the
user by showing it in a different color or with an
underline.

ExampleÂ 8.14.Â Using
<a href="...">

Usage:

<p>More information is available at the
<a href="http://www.&os;.org/">&os; web site</a>.</p>

This link always takes the user to the top of the linked
document.

8.5.3.2.Â Linking to Specific Parts of Documents

To link to a specific point within a document, that
document must include an anchor at the
desired point. Anchors are included by setting the
id attribute of an
element to a name. This example creates an anchor by
setting the id
attribute of a p
element.

ExampleÂ 8.15.Â Creating an Anchor

Usage:

<p id="samplepara">This paragraph can be referenced
in other links with the name <tt>samplepara</tt>.</p>

Links to anchors are similar to plain links, but include
a # symbol and the anchor's
ID at the end of the
URL.

ExampleÂ 8.16.Â Linking to a Named Part of a Different
Document

The samplepara example is part of a
document called foo.html. A link to
that specific paragraph in the document is constructed in
this example.

<p>More information can be found in the
<a href="foo.html#samplepara">sample paragraph</a> of
<tt>foo.html</tt>.</p>

To link to a named anchor within the same document, omit
the document's URL, and just use the
# symbol followed by the name of the
anchor.

ExampleÂ 8.17.Â Linking to a Named Part of the Same Document

The samplepara example
resides in this document. To link to it:

<p>More information can be found in the
<a href="#samplepara">sample paragraph</a> of this
document.</p>