Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Character-Level Elements 123

7


<code> This tag indicates that the text inside is a code sample and displays it
in a fixed-width font such as Courier. For example:
<p><code>#include "trans.h"</code></p>
<samp> This tag indicates sample text and is generally presented in a fixed-
width font, like <code>. An example of its usage follows :
<p>The URL for that page is <samp>http://www.cern.ch/
</samp></p>
<kbd> This tag indicates text that’s intended to be typed by a user. It’s also
presented in a fixed-width font. Consider the following :
<p>Type the following command: <kbd>find. -name "prune"
-print</kbd></p>
<var> This tag indicates the name of a variable, or some entity to be replaced
with an actual value. Often it’s displayed as italic or underline and is
used as follows:
<p><code>chown</code> <var>your_name for the_file
</var></p>
<dfn> This tag indicates a definition. <dfn> is used to highlight a word (usu-
ally in italics) that will be defined or has just been defined, as in the
following example:
<p>Styles that are named after how they are actually
used are called
<dfn>logical styles</dfn></p>
<cite> This tag indicates the cited title of a work—usually displayed in italics.
It is written as in the following:
<p>"use the Force, Luke" <cite>"Star Wars"</cite> (1976)</p>
<abbr> This tag indicates the abbreviation of a word, as in the following:
<p>Use the standard two-letter state abbreviation
(such as <abbr>CA</abbr> for California)</p>

Only the <abbr> tag made it into HTML5, <acronym> has been
removed due to redundancy. You may still see it used, but you
should use the <abbr> tag instead.

NOTE

The following code snippets demonstrate each of the semantic HTML tags mentioned,
and Figure 7.1 illustrates how al l the tags are displayed.

Free download pdf