HTML and CSS Reference
We'll start with some background on how and why the particular set of
new elements in HTML5 was chosen. Then we'll examine new elements
for the overall structure of web pages before moving on to elements,
both new and redefined, intended for particular bits of content. You'll
then learn about the new attributes in HTML5 . Next, we'll spend a few
pages considering the more conceptual issue of the new approach to
element categorization in HTML5 . Finally, you'll go back to practicali-
ties and learn how to make sure your new HTML5 content will work in
Why do we need new elements?
This section looks at some of the research that went into understanding
the document structures that web authors were trying to describe
semantically with HTML ; this information was used to decide which
new elements should be added in HTML5 . We'll then look at each of
the new elements in turn.
What does semantic mean?
At heart, HTML is a way of describing hyperlinked documents: documents that
are linked together as part of a network of knowledge. The elements of HTML
are meant to mean something , and that meaning is what we refer to as the se-
mantics . Because HTML describes documents, the semantics are along the lines
of “this content is a paragraph,” “this content is a level-one heading,” and “this
content is an unordered list.”
Being able to describe the structure of a document this way is valuable because
it lets you keep the details of how to best display content separate from the con-
tent itself. The result is that the same web page, if well structured, can easily be
read on a desktop computer, a mobile phone, and a text-to-speech converter.
Compare this to a document format like PDF, where the layout and content are
deeply interlinked because the fidelity of the eventual printed output is the pri-
mary goal. It's usually awkward to read an A4 PDF on a mobile device because
there's no option other than to view it at A4 size.
HTML4 has two built-in methods for extending the semantics of ele-
ments: the id and class attributes. The id attribute is a unique identi-
fier, but, rather than a random string, the identifier can be a meaningful
word—in other words, it can have semantic value. The class isn't