Embedded Tags
You probably noticed right away, perhaps in
surprise, that the browser displays less than half of the example
source text. Closer inspection of the source reveals that
what’s missing is everything that’s
bracketed inside a pair of less-than (<
) and
greater-than (>
) characters. [Section 3.3.1]
HTML and XHTML are embedded languages: you insert their directions, or tags, into the same document that you and your readers load into a browser to view. The browser uses the information inside those tags to decide how to display or otherwise treat the subsequent contents of your document.
For instance, the <i>
tag that follows the
word “Hello” in the simple example
tells the browser to display the following text in italics.[6] [Section 4.5]
The first word in a tag is its formal name, which usually is fairly
descriptive of its function, too. Any additional words in a tag are
special attributes, sometimes with an associated
value after an equals sign (=
), which further
define or modify the tag’s actions.
Start and End Tags
Most tags define and affect a discrete
region of your document. The region begins where the tag and its
attributes first appear in the source document (a.k.a. the
start tag ) and continues until a corresponding
end tag. An end tag is the
tag’s name preceded by a forward slash
(/
). For example, the end tag that matches the
“start italicizing”
<i>
tag is </i>
.
End tags never include attributes. In HTML, most tags, but not all, have an end tag. And, to make ...
Get HTML & XHTML: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.