Table Of ContentHTML & XHTML
The Definitive Guide
Other resources from O’Reilly
Related titles Ajax Hacks™ Head Rush Ajax
CSS Cookbook™ JavaScript: The Definitive
CSS: The Definitive Guide Guide
Designing Interfaces Learning JavaScript
Dynamic HTML: Web Design in a Nutshell
The Definitive Guide Web Site Cookbook™
Head First HTML with CSS
& XHTML
oreilly.com oreilly.com is more than a complete catalog of O’Reilly books.
You’llalsofindlinkstonews,events,articles,weblogs,sample
chapters, and code examples.
oreillynet.comistheessentialportalfordevelopersinterestedin
openandemergingtechnologies,includingnewplatforms,pro-
gramming languages, and operating systems.
Conferences O’Reillybringsdiverseinnovatorstogethertonurturetheideas
thatsparkrevolutionaryindustries.Wespecializeindocument-
ing the latest tools and systems, translating the innovator’s
knowledgeintousefulskillsforthoseinthetrenches.Visitcon-
ferences.oreilly.com for our upcoming events.
Safari Bookshelf (safari.oreilly.com) is the premier online refer-
ence library for programmers and IT professionals. Conduct
searchesacrossmorethan1,000books.Subscriberscanzeroin
on answers to time-critical questions in a matter of seconds.
Read the books on your Bookshelf from cover to cover or sim-
ply flip to the page you need. Try it today for free.
SIXTH EDITION
HTML & XHTML
The Definitive Guide
Chuck Musciano and Bill Kennedy
Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo
HTML & XHTML: The Definitive Guide, Sixth Edition
by Chuck Musciano and Bill Kennedy
Copyright © 2007, 2002, 2000, 1998, 1997, 1996 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (safari.oreilly.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 [email protected].
Editor: Tatiana Apandi Indexer: Johnna VanHoose Dinse
Production Editor: Colleen Gorman Cover Designer: Edie Freedman
Copyeditor: Audrey Doyle Interior Designer: Melanie Wang
Proofreader: Colleen Gorman Illustrators: RobertRomanoandJessamynRead
Printing History:
April 1996: First Edition.
May 1997: Second Edition.
August 1998: Third Edition.
August 2000: Fourth Edition.
August 2002: Fifth Edition.
October 2006: Sixth Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc.HTML & XHTML: The Definitive Guide, the image of a koala, and related trade
dress are trademarks of O’Reilly Media, Inc.
Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedas
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors
assume no responsibility for errors or omissions, or for damages resulting from the use of the
information contained herein.
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN-10: 0-596-52732-2
ISBN-13: 978-0-596-52732-7
[M]
This book is dedicated to our wives and children,
Cindy, Courtney, and Cole, and Jeanne, Eva, and Ethan.
Without their love and patience, we never would have
had the time or strength to write.
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii
1. HTML, XHTML, and the World Wide Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 The Internet 1
1.2 Talking the Internet Talk 4
1.3 HTML and XHTML: What They Are 8
1.4 HTML and XHTML: What They Aren’t 9
1.5 Standards and Extensions 10
1.6 Tools for the Web Designer 12
2. Quick Start. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1 Writing Tools 15
2.2 A First HTML Document 16
2.3 Embedded Tags 17
2.4 HTML Skeleton 18
2.5 The Flesh on an HTML or XHTML Document 19
2.6 Text 20
2.7 Hyperlinks 24
2.8 Images Are Special 27
2.9 Lists, Searchable Documents, and Forms 30
2.10 Tables 31
2.11 Frames 32
2.12 Stylesheets and JavaScript 33
2.13 Forging Ahead 34
3. Anatomy of an HTML Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.1 Appearances Can Deceive 35
3.2 Structure of an HTML Document 36
vii
3.3 Tags and Attributes 37
3.4 Well-Formed Documents and XHTML 41
3.5 Document Content 42
3.6 HTML/XHTML Document Elements 44
3.7 The Document Header 47
3.8 The Document Body 51
3.9 Editorial Markup 52
3.10 The <bdo> Tag 55
4. Text Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.1 Divisions and Paragraphs 57
4.2 Headings 65
4.3 Changing Text Appearance and Meaning 70
4.4 Content-Based Style Tags 71
4.5 Physical Style Tags 78
4.6 Precise Spacing and Layout 83
4.7 Block Quotes 96
4.8 Addresses 99
4.9 Special Character Encoding 101
4.10 HTML’s Obsolete Expanded Font Handling 102
5. Rules, Images, and Multimedia. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.1 Horizontal Rules 109
5.2 Inserting Images in Your Documents 116
5.3 Document Colors and Background Images 143
5.4 Background Audio 150
5.5 Animated Text 153
5.6 Other Multimedia Content 156
6. Links and Webs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.1 Hypertext Basics 159
6.2 Referencing Documents: The URL 160
6.3 Creating Hyperlinks 176
6.4 Creating Effective Links 185
6.5 Mouse-Sensitive Images 189
6.6 Creating Searchable Documents 200
6.7 Relationships 203
6.8 Supporting Document Automation 208
viii | Table of Contents
Description:Other resources from O'Reilly. Related titles Ajax Hacks™. CSS Cookbook™. CSS: The Definitive Guide. Designing Interfaces. Dynamic HTML: The Definitive Guide. Head First HTML with CSS. & XHTML. Head Rush Ajax. JavaScript: The Definitive. Guide. Learning JavaScript. Web Design in a Nutshell.