By Chuck Musciano, Bill Kennedy
Book Price: $49.99 USD
£35.50 GBP
PDF Price: $39.99
Cover | Table of Contents
www.oreilly.com translates to a machine
named "www" that's part of the domain known as "oreilly," which, in
turn, is part of the commercial (com) branch of the Internet. Other
branches of the Internet include educational institutions (edu),
nonprofit organizations (org), the U.S. government (gov), and Internet
service providers (net). Computers and networks outside the United
States may have two-letter abbreviations at the end of their names: for
example, "ca" for Canada, "jp" for Japan, and "uk" for the United
Kingdom.<html> <head> <title>My first HTML document</title> </head> <body> <h2>My first HTML document</h2> Hello, <i>World Wide Web!</i> <!— No "Hello, World" for us —> <p> Greetings from<br> <a href="http://www.ora.com">O'Reilly</a> <p> Composed with care by: <cite>(insert your name here)</cite> <br>©2000 and beyond </body> </html>
<) and greater-than (>) characters. [The Syntax of a Tag, 3.3.1]<i> tag
that follows the word Hello in the simple example
tells the browser to display the following text in italics. [Physical Style Tags,
4.5]=), which further define or modify the tag's
actions./). For example, the end tag that matches
the "start italicizing" <i>
tag is </i>.<html> and </html> tags. These tags tell the
browser that the entire document is composed in HTML. The HTML and XHTML standards require an <html> tag for compliant documents, but
most browsers can detect and properly display HTML encoding in a text
document that's missing this outermost structural tag. [<html>, 3.6.1]<title> and </title> tags in your document's header.
The popular browsers typically display the title at the top of the
document's window. [<title>,
3.7.2]<html>, <head>, <body>, and <title> tags, the HTML and XHTML
standards have few other required structural elements. You're free to
include pretty much anything else in the contents of your document. (The
web surfers among you know that authors have taken full advantage of
that freedom, too.) Perhaps surprisingly, though, there are only three
main types of HTML/XHTML content: tags (which we described previously), comments, and text. <!— and ending tag —> comment delimiters, gets included in
the browser display of your document. You see a comment in the source,
as in our simple HTML example, but you don't see it on the display, as
evidenced by our comment's absence in Figure 2-1. Anyone can download the
source text of your documents and read the comments, though, so be
careful what you write.protocol://server_domain_name/pathnamehttp://www.kumquat.com/docs/catalog/price_list.htmlftp://ftp.netcom.com/pub<img>; its required src
attribute is the image file that you want to display in the document.
[<img>,
5.2.6]align
property, whose value you set to put the image at the top, middle, or bottom of adjacent text. Examine Figures 2-2 through 2-4 for the image alignment you
prefer. Of course, wide images may take up the whole line and hence
break the text flow. You can also place an image by itself, by
including preceding and following division, paragraph, or line-break
tags.
<ul> and </ul> tags. Each item in the list,
usually a word or short phrase, is marked by the <li> (list-item) tag and, particularly
with XHTML, the </li> end
tag. When rendered, the list item typically appears indented from the
left margin, preceded by a bullet symbol. [<ul>, 7.1.1] [<li>, 7.3]<ol> and </ol> tags, are identical in format to
unordered ones, including the <li> tag (and </li> end tag with XHTML) for marking
list items. However, the order of items is important—as in equipment
assembly steps, for instance. The browser accordingly displays each
item in the list preceded by an ascending number. [<ol>, 7.2.1]<dl> and </dl> tags, each list item has two
parts, each with a special tag: a short name or title, contained
within a <table> tag itself and a <caption> tag for including a
description of the table. Special tag attributes let you change the look
and dimensions of the table. You create a table row by row, putting
between the table row (<tr>)
tag and its end tag (</tr>)
either table header (<th>) or
table data (<td>) tags and
their respective contents for each cell in the table (end tags, too,
with XHTML). Headers and data may contain nearly any regular content,
including text, images, forms, and even another table. As a result, you
can also use tables for advanced text formatting, such as sidebar
headers (see Figure 2-5). For
more information, see Chapter
10.
<body> tag with one or more
<frameset> tags that tell the
browser how to divide its main window into discrete frames. Special
<frame> tags go inside the
<frameset> tag and point to the
documents that go inside the frames. [<frameset>, 11.3.1]h1) header text in your HTML
document appear in the color red:<html>
<head>
<title>CSS Example</title>
<!— Hide CSS properties within comments so old browsers
don't choke on or display the unfamiliar contents. —>
<style type="text/css">
<!—
h1 {color: red}
—>
</style>
</head>
<body>
<h1>I'll be red if your browser supports CSS</h1>
Something in between.
<h1>I should be red, too!</h1>
</body>
</html>
<h1>-enclosed text appears red on a
color screen.<html>, <head>, <frameset>, and <body>, we place elements that
structure the content of a document on a separate line and indented
to show its nesting level within the document. Structural elements
include lists, forms, tables, and similar tags.<b> (bold
text) and document linkages such as <a> (hypertext anchor).<html>
tag enclosing the document:<html> <head> <title>Barebones HTML Document</title> </head> <body> This illustrates, in a very <i>simp</i>le way, the basic structure of an HTML document. </body> </html>
<head> and <body> tags. The head is where you give
your document a title and where you indicate other parameters the
browser may use when displaying the document. The body is where you put
the actual contents of the document. This includes the text for display
and document-control markers (tags) that advise the browser how to
display the text. Tags also reference special-effects files, including
graphics and sound, and indicate the hotspots (hyperlinks and anchors)
that link your document to other documents.<i> and </i> tags respectively tell the browser
to start and stop italicizing the text characters that come between
them. Accordingly, the syllable "simp" in our barebones example in Figure 3-1 should appear italicized
when displayed by the browser.
< and >). The simplest tag is nothing more than
a name appropriately enclosed in brackets, such as <head> and <i>. More complicated tags contain one
or more attributes, which specify or modify the behavior of the
tag.<head>, <Head>, <HEAD>, and even <HeaD>; all of them are equivalent.
With XHTML, case is important: all current
standard tag and attribute names are in lowercase; always <head>, never <HEAD>.=) after the attribute name. You
may include spaces around the equals sign so that