Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page iii
Creating Cool
Web Sites with
HTML, XHTML,
and CSS
Dave Taylor
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page ii
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page i
Creating Cool
Web Sites with
HTML, XHTML,
and CSS
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page ii
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page iii
Creating Cool
Web Sites with
HTML, XHTML,
and CSS
Dave Taylor
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page iv
Creating Cool Web Sites with HTML, XHTML, and CSS
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE
CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please contact our Customer
Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be
available in electronic books.
Trademarks: Wiley, the Wiley Publishing logo and related trade dress are trademarks or registered trademarks of
John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without
written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not
associated with any product or vendor mentioned in this book.
Copyright © 1994-2003 World Wide Web Consortium (Massachusetts Institute of Technology, European Research
Consortium for Informatics and Mathematics, Keio University). All Rights Reserved.
http://www.w3.org/
Consortium/Legal/2002/copyright
documents 20021231.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page v
About the Author
Dave Taylor has been involved with the Internet since 1980, when he first logged in as an
undergraduate at the University of California, San Diego. Since then, he’s been a research
scientist at Hewlett-Packard Laboratories in Palo Alto, California, reviews editor for SunWorld
magazine, and founder of four companies: The Internet Mall, iTrack.com, AnswerSquad, and
ClickThruStats.com. Currently, Dave is president of Intuitive Systems and is busy launching
an electronic book publishing company called Intuitive Press.
Dave has designed over 50 Web sites, both commercial and nonprofit, and has published
more than 1000 articles about the Internet, Unix, Macintosh, interface design, and business
topics. His books include Learning Unix for Mac OS X Panther (O’Reilly), Wicked Cool Shell
Scripts (No Starch Press), Teach Yourself Unix in 24 Hours (Sams Publishing), and Solaris
For Dummies (Wiley Publishing).
Dave holds a master’s degree in Educational Computing from Purdue University, an M.B.A.
Bob Ipsen
Vice President and Publisher
Joseph B. Wikert
Executive Editorial Director
Mary Bednarek
Project Coordinator
April Farling
Graphics and Production Specialists
Beth Brooks
Jonelle Burns
Jennifer Heleine
Quality Control Technician
Susan Moritz
Permissions Editor
Laura Moss
Media Development Specialist
Angela Denny
Book Designer
Kathie S. Schnorr
Proofreading and Indexing
Publication Services
Cover Design
Michael Trent
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page viii
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page ix
To Kiana, Gareth, and Ashley, my guardian angels
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page x
XHTML, and CSS, but also quite a lot about how to design and create useful, attractive Web
sites and spread the word about them on the Net.
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page xii
Ł
Preface
xii
Before you delve into this book, you should know the basics: what the Internet is, how to get
on it, and how to use your Web browser. If you seek detailed information on these topics, you
can find many interesting and useful books from Wiley Publishing at http://www.wiley.com/
compbooks. After you have this basic knowledge, you’ll find that Creating Cool Web Sites with
HTML, XHTML, and CSS is a fun introduction to the art and science of creating interesting—
and, if I may say so, cool—Web sites that you’ll be proud of and that other users will want to
visit and explore.
Why Not Just Use a Web Page Builder?
If you’ve already flipped through this book to see what’s covered, you’ve seen a ton of differ
ent sample listings with lots and lots of
<
and
>
instructions. Yet the advertisements in every
computer magazine are telling you that you don’t need to get your hands dirty with HTML
and CSS when you can use a Web page editor. So what’s the scoop?
The scoop—or the problem, really—is that every Web page editor I’ve used is designed to
create pages for a particular Web browser and has at best a limited understanding of the rich,
complex, evolving HTML language. Use Microsoft Front Page 2000, for example, and your
site will almost certainly look best in Internet Explorer (a Microsoft product).
It’s a subtle but insidious problem. One clue to this lurking problem is that surveys of Web
developers invariably demonstrate that almost all the most popular Web sites are coded by
hand, not with fancy page-building systems.
like this:
<html>
<title>How to Create Cool Web Sites</title>
<img src=”intro.gif” alt=”How To Create Cool Web Sites” />
Icons Used to Help You Navigate
I use the following icons to help you find your way around the text and to point out important
additional information that I want to emphasize.
Ł
This icon points out some expert tricks and techniques that can help you work
tip
more efficiently.
Ł
Pay attention to this icon. It alerts you to possible pitfalls and may help you avoid
caution
trouble.
Ł
Check out this icon for additional details that deserve special attention and may
note
help you work better in the long term.
Ł
Jump to the chapters elsewhere in the book that this icon points you to. You’re
x-ref
bound to run into some good information or more details about the topic at hand.
This icon points you to helpful information or samples on the companion Web site
on the
that accompanies this book (
http://www.intuitive.com/coolsites/
) or to sites
Ł
elsewhere on the Net.
Sheets add to the equation, as well as why it’s crazy not to include at least rudimentary CSS
elements in your everyday site development work.
Want to contact the author? Send e-mail to
[email protected]
or visit my home page
on the Web at
http://www.intuitive.com/
.
If you’re ready, let’s go!
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
557386 FM.qxd 4/2/04 10:00 AM Page xv
Acknowledgments
N
o writing project can be completed while the author is locked in a room, although if
there’s a good Net connection, we can probably negotiate something! Seriously, a num
ber of Internet folk have proven invaluable as I’ve written the different editions of this book—
some for their direct help and others for simply having produced some wickedly cool Web
pages that inspired me when things were moving a bit slowly.
Special thanks go to my many students at The University of Phoenix Online and elsewhere
who helped clarify what made sense and what didn’t in the previous editions of the book. I
also particularly appreciate the continued assistance of the team at Wiley Publishing, includ
ing notably Sharon Cox and Jodi Jensen, and Dreamtech for the technical edit. My friends
and colleagues John Locke, Bo Leuf, Werner Klauser, Jon Shemitz, Richard Blum, and Jon
Trelfa helped keep the content fresh and accurate and helped to continually remind me that
there’s more to learn. Special thanks also to search engine expert Dan Murray for his help on
Google page ranking algorithms.
Most of the graphics presented in this book were created in GraphicConverter, a wonderful
shareware application for the Macintosh, though I used Adobe Photoshop CS a few times.
Screen shots were done with MW Snap on the PC and Snapz Pro X on the Macintosh. Most of
the book was written on my aging Apple Macintosh G4/450 system (I have to admit, I’m a
Special characters in URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
E-mail via URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Telnet via URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Usenet news via URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
The heart of the Web: HTTP URLs . . . . . . . . . . . . . . . . . . . . . . . . . 18
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 2: Building Your First Web Page: HTML Basics . . . . . . . . . . . . 21
Basics of HTML Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
HTML and browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
If you open it, close it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Breaking at Paragraphs and Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Building Your First Web Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Launching your HTML editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Saving your file as HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.