In earlier versions of HTML (i.e., <4.0) these were called information type elements, the idea being that they can be used to describe the type of information conveyed by their contents.
These elements appear in section 9.2.1 of the HTML 4.01 Specification.
In the list below, examples of HTML code appear in buff-colored boxes while the results of this code when rendered by the browser appear in blue-colored boxes.
I wish to emphasize that <em>you should avoid using
the <i> tag</em> when
marking up documents for the web.
I wish to emphasize in the strongest possible terms
that <strong>you should avoid using the <b>
tag</strong> when
marking up documents for the web.
We are reading <cite>The Two-in-One</cite> in this course.
It's fun and profitable to learn
<abbr title="HyperText Markup Language">HTML</abbr>.
The Secretary of State met with the
<acronym title="North Atlantic Treaty Organization">NATO</acronym>
cyberterrorism working group.
According to the specification, a <dfn>phrase element</dfn>
is an HTML construct that adds structural information to text fragments.
Here's a common technique for exchanging the value
of two variables:
<code>
if (a != b) {
temp = a;
a = b;
b = temp;
}
</code>
if (a != b) {
temp = a;
a = b;
b = temp;
}
There's a way to get around this using stylesheets: you can define
code { white‑space: pre }
using CSS.
Unfortunately, most contemporary browsers ignore this. So
the quick fix (technically called a “kludge”)
is to use <code> to preserve the information type and
wrap it in a <pre> to get the desired formatting.
Here's an example:
Here's a common technique for exchanging the value
of two variables:
<pre><code>if (a != b) {
temp = a;
a = b;
b = temp;
}</code></pre>
if (a != b) {
temp = a;
a = b;
b = temp;
}
After bash has loaded, it will respond with a prompt:
<samp>
[nestudent@warp nestudent]$
</samp>
In order to see the permissions on your files, type
<kbd>ls -l</kbd> at the bash prompt.
Let <var>G</var> be a group.
Well, in theory you can do this. By default, use of an unmodified <q> should give you plain old "straight quotes", but IE doesn't even do that. The Mozilla family handles the default <q> correctly, but whether it nests them properly or not depends upon the version of the browser. (Firefox version 1.5 does nest the quotes correctly, though earlier versions didn't.) You can try the examples below on other browsers to see what happens.
q:lang(en) { quotes: "\201C" "\201D" "\2018" "\2019"}
q:lang(fr) { quotes: "\AB\2009" "\2009\BB" "\2039" "\203A" }
q:before { content: open-quote }
q:after { content: close-quote }
As Casey Stengel tells it, <q>Well, Yogi Berra once said to me,
<q>When you come to a fork in the road, take it</q>.</q>
Comme raconte Casey Stengel, <q lang="fr" xml:lang="fr">Mais, Yogi Berra me dit un fois,
<q lang="fr" xml:lang="fr">Quand on arrive à une fourche …</q>.</q>
Well, Yogi Berra once said to me,Comme raconte Casey Stengel,When you come to a fork in the road, take it.
Mais, Yogi Berra me dit un fois,
Quand on arrive à une fourche …
.
The examples displayed above are styled according to the browser default (of whatever browser you're reading this in). But remember that the main point of HTML markup is to capture to the greatest extent possible the logical structure of your document. You can always apply your own custom styles to these elements to make them look (or sound) however you like. So if you'd prefer the <dfn> element to appear as bold italics, don't mark up its content as <em><strong>the content</strong></em>—use the <dfn> tag and use CSS to define it to display as bold italics.
[ Return to the CPSCI 105-01 homepage ]
Brian J. Rosmaita <contact me>