Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

32 CHAPTER 2 Getting started with HTML5


is italic text; for example, a taxonomic designation, a technical term, an idiomatic phrase from
another language, a thought, or a ship name.” Do these tags need to render as bold and
italic? Not at all, and the new definitions of these tags attempt to specify this.
Chapter 5, “More HTML5,” revisits the notion of semantic markup. For now, remember that
your HTML tags should be used to provide structure, not presentation. Presentation is the
cascading style sheet’s job.

Working with elements


An element is composed of a beginning tag, an ending tag, and the content between the
tags. Consider the following HTML fragment.
<div>
The quick brown <b>fox</b> jumps over the lazy dog
</div>

In this sample, the <div> tag is just the beginning tag on the first line. The <div> element
is the complete sample, which includes content that also contains a <b> element. The <b>
element consists of the beginning <b> tag, the content, which is the word “fox,” and the end-
ing </b> tag.
The <div> element creates a section in your document. It’s common to use <div> ele-
ments to denote a section to which you will attach a style. You’ll see many uses of the <div>
element in this book and on most websites.
HTML tag names are not case sensitive. If you’re working on an older webpage, you might
notice that it was written using uppercase tag names. Browsers will treat a <b> tag and a <B>
tag the same.
To comply with as many standards as possible, consider using lowercase tag names for any
webpages you create by convention because the W3C recommends lowercase tag names in
HTML 4.01 and requires lowercase tag names in XHTML. Although HTML5 does not mandate
lowercase tag names, lowercase tag names are recommended.

Element reference
HTML5 has more than 100 defined elements that you can use to create rich webpages and
applications. The W3C defines the following list of these elements with a brief description.
Note that brevity is a substitute for 100 percent accuracy in these descriptions.
■■<a> Hyperlink
■■<abbr> Abbreviation
■■<address> Contact information
■■<area> Image map region
■■<article> Independent section
■■<aside> Auxiliary section
■■<audio> Audio stream

Key
Te rms
Free download pdf