Datasheet

18
Part I: Getting to Know (X)HTML and CSS
Markup color-coding
As we present HTML, XHTML, and CSS information in our code samples, we
use color-coding to help you distinguish what’s what by way of markup. Here is
a color key that you should keep in mind as you read all of our code listings:
Purple Indicates the DOCTYPE declaration used in (X)HTML docu-
ments. This is actually a totally different markup language known as the
Standard Generalized Markup Language, or SGML. SGML is used to iden-
tify what specific set of rules that (X)HTML documents follow in their
construction and content. It also applies to codes for character entities,
such as the following:
&pos;
&123;
Light green Indicates ordinary garden variety XHTML and HTML
markup
Dark green Indicates XML markup
Orange Indicates Cascading Style Sheet, or CSS, markup
Blue Indicates JavaScript
We only colorize markup in code listings and code blocks because it affects
readability too much when code appears in body copy. In that case, we
simply use a different, monospaced font — as you’ll see in the discussions of
the <html>, <head>, and <title> elements in our first paragraph that dis-
cusses HTML markup here.
One more thing: If you use an HTML editor, such as HTML Kit, Dreamweaver,
Kompozer, or whatever, you find these tools also use text color to help you
identify different kinds of markup. The thing is that none of these tools do
this the same way, and none of them match the way we do it here — we
picked out colors that would be easy to see (and distinguish) when viewed
on a four-color printed page; whereas others picked their colors to look good
on LCD displays.
Elements
Elements are the building blocks of (X)HTML. You use them to describe
every piece of text on your page. Elements are made up of tags and the con-
tent within those tags. There are two main types of elements:
Elements with content made up of a tag pair and whatever content sits
between the opening and closing tags in the pair
Elements that insert something into the page, using a single tag
06_9780470916599-ch01.indd 1806_9780470916599-ch01.indd 18 11/30/10 12:23 AM11/30/10 12:23 AM