HTML and CSS Reference
In-Depth Information
unique, but multiple classes can be applied to a single element like tag-
ging in popular social network tools. Some examples are shown in the
following table.
Markup
Suggested meaning
<p>
A paragraph
<p id="author">
A paragraph that represents a particular author
<p class="bio">
A paragraph that represents a biography
<p class="author bio">
A paragraph that represents an author biography
No definitive standard sets down which values mean what,
1
so one site
could use
writer
for the same thing another site uses
author
for, or two
sites could use
author
to mean something completely different. This
isn't a huge issue, because
HTML
isn't intended to describe real-world
things like authors, so the meaning behind those values is likely to be
site-specific anyway. But
id
and
class
attributes can also be used to
describe document features; for instance, a
nav
class would probably
indicate an element that contains navigation. If you were looking for
ideas for new elements to add to
HTML
to improve its ability to
describe documents, a survey of the sorts of values used in
id
and
class
attributes would be a good place to start.
With this in mind, in 2005 several studies were done that attempted to
analyze how authors were using
id
and
class
values in markup on the
web. Two of these are of particular interest to us:
In November 2005, a study of 1,315 websites counted how often dif-
ferent values for the
id
attribute were used.
❂
In December 2005, a study of slightly over a billion web pages ana-
lyzed, among other things, how often particular class names
appeared.
❂
1
Although some have attempted it. See the discussion of microformats later in this chapter.