0% found this document useful (0 votes)
10 views

Sams Teach Yourself Web Publishing with HTML XHTML in 21 Days 4th Edition Laura Lemay - Quickly download the ebook to never miss important content

The document provides information about various ebooks available for instant download on ebookgate.com, including titles on web publishing, Java, MySQL, and more. Each title includes a link for direct access to the ebook. The content also outlines the structure and chapters of 'Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days' by Laura Lemay.

Uploaded by

tabauidal2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Sams Teach Yourself Web Publishing with HTML XHTML in 21 Days 4th Edition Laura Lemay - Quickly download the ebook to never miss important content

The document provides information about various ebooks available for instant download on ebookgate.com, including titles on web publishing, Java, MySQL, and more. Each title includes a link for direct access to the ebook. The content also outlines the structure and chapters of 'Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days' by Laura Lemay.

Uploaded by

tabauidal2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Instant Ebook Access, One Click Away – Begin at ebookgate.

com

Sams Teach Yourself Web Publishing with HTML XHTML


in 21 Days 4th Edition Laura Lemay

https://ebookgate.com/product/sams-teach-yourself-web-
publishing-with-html-xhtml-in-21-days-4th-edition-laura-
lemay/

OR CLICK BUTTON

DOWLOAD EBOOK

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Click here to visit ebookgate.com and download ebook now
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Sams teach yourself Java 2 in 21 days 3rd ed Edition Laura


Lemay

https://ebookgate.com/product/sams-teach-yourself-
java-2-in-21-days-3rd-ed-edition-laura-lemay/

ebookgate.com

Sams Teach Yourself Web Publishing with HTML and CSS in


One Hour a Day Includes New HTML5 Coverage 6th Edition
Laura Lemay
https://ebookgate.com/product/sams-teach-yourself-web-publishing-with-
html-and-css-in-one-hour-a-day-includes-new-html5-coverage-6th-
edition-laura-lemay/
ebookgate.com

Sams Teach Yourself MySQL in 21 Days 2nd Edition Anthony


Butcher

https://ebookgate.com/product/sams-teach-yourself-mysql-
in-21-days-2nd-edition-anthony-butcher/

ebookgate.com

Sams Teach Yourself NET Windows Forms in 21 Days 1st


Edition Chris Payne

https://ebookgate.com/product/sams-teach-yourself-net-windows-forms-
in-21-days-1st-edition-chris-payne/

ebookgate.com
Sams Teach Yourself Visual C NET in 21 Days 2nd Edition
Davis Chapman

https://ebookgate.com/product/sams-teach-yourself-visual-c-net-
in-21-days-2nd-edition-davis-chapman/

ebookgate.com

Sams Teach Yourself Microsoft Access 2002 Programming in


24 Hours Sams Teach Yourself 1st Edition Paul Kimmel

https://ebookgate.com/product/sams-teach-yourself-microsoft-
access-2002-programming-in-24-hours-sams-teach-yourself-1st-edition-
paul-kimmel/
ebookgate.com

Sams Teach Yourself Perl in 24 Hours 3rd Edition Clinton


Pierce

https://ebookgate.com/product/sams-teach-yourself-perl-
in-24-hours-3rd-edition-clinton-pierce/

ebookgate.com

Sams Teach Yourself SQL in 24 Hours 3rd Edition Ryan


Stephens

https://ebookgate.com/product/sams-teach-yourself-sql-in-24-hours-3rd-
edition-ryan-stephens/

ebookgate.com

Sams Teach Yourself AppleScript in 24 Hours 1st Edition


Jesse Feiler

https://ebookgate.com/product/sams-teach-yourself-applescript-
in-24-hours-1st-edition-jesse-feiler/

ebookgate.com
Laura Lemay
with revisions by Rafe Colburn

Teach Yourself

Web Publishing with


HTML and XHTML
in 21 Days
FOURTH EDITION

800 East 96th Street, Indianapolis, Indiana 46240


ACQUISITIONS EDITOR
Sams Teach Yourself Web Publishing Betsy Brown
with HTML and XHTML in 21 Days DEVELOPMENT EDITOR
Fourth Edition Jonathan Steever
MANAGING EDITOR
Copyright © 2003 by Sams Publishing
Charlotte Clapp
All rights reserved. No part of this book shall be reproduced, stored in a
retrieval system, or transmitted by any means, electronic, mechanical, photo- PROJECT EDITOR
copying, recording, or otherwise, without written permission from the pub- George E. Nedeff
lisher. No patent liability is assumed with respect to the use of the information
COPY EDITOR
contained herein. Although every precaution has been taken in the preparation
Mike Henry
of this book, the publisher and author assume no responsibility for errors or
omissions. Neither is any liability assumed for damages resulting from the use INDEXER
of the information contained herein. Erika Millen
International Standard Book Number: 0-672-32519-5 PROOFREADER
Mike Henry
Library of Congress Catalog Card Number: 2002-114453
TECHNICAL EDITOR
Printed in the United States of America
Jason Perkins
First Printing: May 2003
TEAM COORDINATOR
05 04 03 4 3 2 Vanessa Evans
SOFTWARE DEVELOPMENT
Trademarks SPECIALIST
All terms mentioned in this book that are known to be trademarks or service Dan Scherf
marks have been appropriately capitalized. Sams Publishing cannot attest to
the accuracy of this information. Use of a term in this book should not be DESIGNER
regarded as affecting the validity of any trademark or service mark. Gary Adair
PRODUCTION
Warning and Disclaimer Eric S. Miller
Every effort has been made to make this book as complete and as accurate as
possible, but no warranty or fitness is implied. The information provided is on
an “as is” basis. The authors and the publisher shall have neither liability nor
responsibility to any person or entity with respect to any loss or damages aris-
ing from the information contained in this book.

Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quan-
tity for bulk purchases or special sales. For more information, please contact

U.S. Corporate and Government Sales


1-800-382-3419
corpsales@pearsontechgroup.com

For sales outside of the U.S., please contact

International Sales
1-317-428-3341
international@pearsontechgroup.com
Contents at a Glance
Introduction 1

Part I Getting Started 7


Day 1 The World of the World Wide Web 9
2 Get Organized 25
3 An Introduction to HTML 47
4 Begin with the Basics 65

Part II Creating Simple Web Pages 93


Day 5 All About Links 95
6 More Text Formatting with HTML and CSS 127
7 Using Images, Color, and Backgrounds 171

Part III Doing More with HTML and XHTML 207


Day 8 Tables 209
9 Formatting Pages with Cascading Style Sheets 261
10 Designing Forms 299

Part IV Graphics and Multimedia 335


Day 11 Imagemaps and Animated Graphics 337
12 Multimedia: Adding Sounds, Videos, and More 367

Part V JavaScript and Dynamic HTML 405


Day 13 JavaScript 407
14 Working with JavaScript 427
15 Working with Frames and Linked Windows 451
16 Dynamic HTML 487

Part VI Designing Effective Web Pages 517


Day 17 Writing Good Web Pages: Do’s and Don’ts 519
18 Designing for the Real World 551
19 Creating Accessible Sites 571
Part VII Going Live on the Web 583
Day 20 Putting Your Site Online 585
21 Taking Advantage of the Server 613

Part VIII Appendixes 633


Appendix A Sources for Further Information 635
B HTML 4.01 Quick Reference 647
C Cascading Style Sheet Quick Reference 693
D Colors by Name and Hexadecimal Value 733
E MIME Types and File Extensions 737
Index 741
Contents
Introduction 1

Part I Getting Started 7

Day 1 The World of the World Wide Web 9


What Is the World Wide Web? ..............................................................................10
The Web Is a Hypertext Information System ..................................................10
The Web Is Graphical and Easy to Navigate ..................................................11
The Web Is Cross-Platform ..............................................................................12
The Web Is Distributed ....................................................................................12
The Web Is Dynamic ........................................................................................13
The Web Is Interactive......................................................................................14
Web Browsers ........................................................................................................16
What the Browser Does....................................................................................17
An Overview of Some Popular Browsers ........................................................17
Using the Browser to Access Other Services ..................................................20
Web Servers ..........................................................................................................21
Uniform Resource Locators ..................................................................................22
Summary ................................................................................................................23
Workshop ..............................................................................................................23
Q&A ................................................................................................................23
Quiz ..................................................................................................................24
Quiz Answers....................................................................................................24
Exercises ..........................................................................................................24

Day 2 Get Organized 25


Anatomy of a Web Site..........................................................................................26
What Do You Want to Do on the Web? ................................................................28
Set Your Goals ......................................................................................................30
Break Up Your Content into Main Topics ............................................................31
Ideas for Organization and Navigation..................................................................32
Hierarchies........................................................................................................32
Linear................................................................................................................35
Linear with Alternatives ..................................................................................36
Combination of Linear and Hierarchical..........................................................37
Web ..................................................................................................................39
Storyboarding Your Web Site ................................................................................41
What’s Storyboarding and Why Do I Need It? ................................................41
Hints for Storyboarding....................................................................................42
Summary ................................................................................................................43
vi Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Workshop ..............................................................................................................44
Q&A ................................................................................................................44
Quiz ..................................................................................................................44
Quiz Answers....................................................................................................45
Exercises ..........................................................................................................45

Day 3 An Introduction to HTML 47


What HTML Is—And What It Isn’t ......................................................................47
HTML Describes the Structure of a Page ........................................................48
HTML Does Not Describe Page Layout..........................................................49
Why It Works This Way ..................................................................................50
HTML Is a Markup Language ........................................................................51
A Brief History of HTML Tags........................................................................51
The Current Standard: XHTML 1.0 ......................................................................52
What HTML Files Look Like................................................................................53
A Note About Formatting ................................................................................57
Using Cascading Style Sheets ..............................................................................58
Including Styles in Tags ..................................................................................59
Programs to Help You Write HTML ....................................................................59
Summary ................................................................................................................61
Workshop ..............................................................................................................61
Q&A ................................................................................................................61
Quiz ..................................................................................................................61
Quiz Answers....................................................................................................62
Exercises ..........................................................................................................62

Day 4 Begin with the Basics 65


Structuring Your HTML ........................................................................................65
The <html> Tag ................................................................................................66
The <head> Tag ................................................................................................67
The <body> Tag ................................................................................................67
The Title ................................................................................................................68
Headings ................................................................................................................70
Paragraphs..............................................................................................................72
Lists, Lists, and More Lists ..................................................................................74
List Tags ..........................................................................................................74
Numbered Lists ................................................................................................75
Customizing Ordered Lists ..............................................................................76
Unordered Lists ................................................................................................80
Customizing Unordered Lists ..........................................................................80
Glossary Lists ..................................................................................................83
Nesting Lists ....................................................................................................85
Comments ..............................................................................................................86
Contents vii

Summary ................................................................................................................88
Workshop ..............................................................................................................90
Q&A ................................................................................................................90
Quiz ..................................................................................................................91
Quiz Answers....................................................................................................91
Exercises ..........................................................................................................92

Part II Creating Simple Web Pages 93

Day 5 All About Links 95


Creating Links........................................................................................................96
The Link Tag—<a> ..........................................................................................96
Linking Local Pages Using Relative and Absolute Pathnames ..........................101
Absolute Pathnames ......................................................................................103
Should You Use Relative or Absolute Pathnames? ........................................104
Links to Other Documents on the Web ..............................................................104
Linking to Specific Places Within Documents ....................................................109
Creating Links and Anchors ..........................................................................110
Linking to Anchors in the Same Document ..................................................116
Anatomy of a URL ..............................................................................................116
Parts of URLs ................................................................................................117
Special Characters in URLs ..........................................................................118
Kinds of URLs ....................................................................................................119
HTTP ..............................................................................................................119
Anonymous FTP ............................................................................................120
Non-Anonymous FTP ....................................................................................121
Mailto..............................................................................................................121
Usenet Newsgroups ........................................................................................122
File ..................................................................................................................122
Summary ..............................................................................................................123
Workshop ............................................................................................................124
Q&A ..............................................................................................................124
Quiz ................................................................................................................126
Quiz Answers..................................................................................................126
Exercises ........................................................................................................126

Day 6 More Text Formatting with HTML and CSS 127


Character-Level Elements....................................................................................128
Logical Styles ................................................................................................128
Physical Styles................................................................................................131
Character Formatting Using CSS ........................................................................133
The Text Decoration Property ........................................................................133
Font Properties................................................................................................134
viii Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Preformatted Text ................................................................................................135


Horizontal Rules ..................................................................................................137
Attributes of the <hr> Tag ..............................................................................138
Line Break............................................................................................................141
Addresses ............................................................................................................142
Quotations ............................................................................................................143
Special Characters................................................................................................144
Character Entities for Special Characters ......................................................145
Character Entities for Reserved Characters ..................................................146
Text Alignment ....................................................................................................147
Aligning Individual Elements ........................................................................147
Aligning Blocks of Elements ........................................................................148
Fonts and Font Sizes............................................................................................149
Changing the Font Size ..................................................................................149
Changing the Font Face..................................................................................151
Modifying Fonts Using CSS ..........................................................................151
<nobr> and <wbr> ................................................................................................153
Summary ..............................................................................................................164
Workshop ............................................................................................................167
Q&A ..............................................................................................................167
Quiz ................................................................................................................168
Quiz Answers..................................................................................................168
Exercises ........................................................................................................169

Day 7 Using Images, Color, and Backgrounds 171


Images on the Web ..............................................................................................172
Image Formats ....................................................................................................173
GIF..................................................................................................................173
JPEG ..............................................................................................................173
PNG ................................................................................................................174
Inline Images in HTML: The <img> Tag ............................................................174
Adding Alternative Text to Images ................................................................175
Images and Text ..................................................................................................179
Text and Image Alignment ............................................................................180
Wrapping Text Next to Images ......................................................................183
Adjusting the Space Around Images ..............................................................185
Images and Links ................................................................................................187
Other Neat Tricks with Images............................................................................191
Image Dimensions and Scaling ......................................................................191
More About Image Borders............................................................................192
Using Color..........................................................................................................193
Naming Colors................................................................................................193
Changing the Background Color....................................................................195
Contents ix

Changing Text Colors ....................................................................................195


Spot Color ......................................................................................................196
Specifying Colors with CSS ..........................................................................197
Color-Related Properties ................................................................................197
Image Backgrounds ............................................................................................198
Hints for Better Use of Images............................................................................200
Do You Really Need This Image? ..................................................................200
Keep Your Images Small ................................................................................200
Reuse Images as Often as Possible ................................................................201
Image Etiquette ....................................................................................................201
Summary ..............................................................................................................202
Workshop ............................................................................................................203
Q&A ..............................................................................................................203
Quiz ................................................................................................................204
Quiz Answers..................................................................................................205
Exercises ........................................................................................................205

Part III Doing More with HTML and XHTML 207

Day 8 Tables 209


Creating Tables ....................................................................................................210
Table Parts............................................................................................................210
The <table> Element ....................................................................................211
The Table Summary ......................................................................................212
Rows and Cells ..............................................................................................212
Empty Cells ....................................................................................................214
Captions ..........................................................................................................215
Sizing Tables, Borders, and Cells ........................................................................219
Setting Table Widths ......................................................................................219
Changing Table Borders ................................................................................220
Cell Padding ..................................................................................................221
Cell Spacing....................................................................................................222
Column Widths ..............................................................................................222
Setting Breaks in Text ....................................................................................224
Table and Cell Color and Alignment ..................................................................225
Changing Table and Cell Background Colors................................................225
Changing Border Colors ................................................................................228
Aligning Your Table Content ..............................................................................229
Table Alignment ............................................................................................229
Cell Alignment................................................................................................230
Caption Alignment..........................................................................................233
Spanning Multiple Rows or Columns ................................................................234
x Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

More Advanced Table Enhancements..................................................................242


Grouping and Aligning Columns ..................................................................242
Grouping and Aligning Rows ........................................................................246
The frame and rules Attributes ....................................................................249
Other Table Elements and Attributes ..................................................................250
How Tables Are Used ..........................................................................................251
Summary ..............................................................................................................252
Workshop ............................................................................................................258
Q&A ..............................................................................................................258
Quiz ................................................................................................................258
Quiz Answers..................................................................................................259
Exercises ........................................................................................................259

Day 9 Formatting Pages with Cascading Style Sheets 261


Including Style Sheets in a Page ........................................................................262
Creating Page-Level Styles ............................................................................262
Creating Sitewide Style Sheets ......................................................................263
Selectors ..............................................................................................................264
Contextual Selectors ......................................................................................264
Classes and IDs ..............................................................................................265
Units of Measure..................................................................................................266
Box Properties......................................................................................................268
Controlling Size..............................................................................................268
Borders............................................................................................................269
Margins and Padding......................................................................................271
Float ................................................................................................................276
CSS Positioning ..................................................................................................280
Relative Positioning........................................................................................281
Absolute Positioning ......................................................................................283
Controlling Stacking ......................................................................................286
Modifying the Appearance of Tables ..................................................................288
The <body> Tag ....................................................................................................291
Links ....................................................................................................................292
Creating Layouts with Multiple Columns ..........................................................293
Summary ..............................................................................................................297
Workshop ............................................................................................................297
Q&A ..............................................................................................................297
Quiz ................................................................................................................298
Quiz Answers..................................................................................................298
Exercises ........................................................................................................298

Day 10 Designing Forms 299


Understanding Form and Function ......................................................................300
Using the <form> Tag ..........................................................................................305
Contents xi

Creating Form Controls with the <input> Tag....................................................307


Creating Text Controls ..................................................................................308
Creating Password Controls ..........................................................................309
Creating Submit Buttons ................................................................................310
Creating Reset Buttons ..................................................................................310
Creating Check Box Controls ........................................................................311
Creating Radio Buttons ..................................................................................312
Using Images As Submit Buttons ..................................................................312
Creating Generic Buttons ..............................................................................313
Hidden Form Fields........................................................................................314
The File Upload Control ................................................................................314
Using Other Form Controls ................................................................................315
Using the button Element..............................................................................315
Create Large Text-Entry Fields with textarea ..............................................316
Creating Menus with select and option ......................................................316
Adding Extras ......................................................................................................322
Displaying Control label Elements ..............................................................322
Grouping Controls with fieldset and legend ..............................................323
Changing the Default Form Navigation ........................................................324
Using Access Keys ........................................................................................324
Creating disabled and readonly Controls ....................................................324
Applying Cascading Style Sheet Properties to Forms ........................................325
Planning Your Forms ..........................................................................................331
Summary ..............................................................................................................332
Workshop ............................................................................................................333
Q&A ..............................................................................................................333
Quiz ................................................................................................................334
Quiz Answers..................................................................................................334
Exercises ........................................................................................................334

Part IV Graphics and Multimedia 335

Day 11 Imagemaps and Animated Graphics 337


What Is an Imagemap? ........................................................................................338
Client-Side Imagemaps........................................................................................339
Imagemaps and Text-Only Browsers ............................................................339
Creating Client-Side Imagemaps ........................................................................339
Getting an Image ............................................................................................340
Determining Your Coordinates ......................................................................340
The <map> and <area> Tags............................................................................343
The usemap Attribute ......................................................................................345
Creating Transparent GIF Files ..........................................................................350
Choosing a Transparent Color........................................................................350
Antialiasing and Transparency ......................................................................351
xii Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Creating Animated GIFs ......................................................................................352


Programs to Help You Compile Animated GIFs ................................................352
Creating Animated GIFs ......................................................................................353
Optimizing Animation Size ................................................................................355
Tools to Help You Create Your Pictures ..............................................................357
Useful Software Features ..............................................................................358
Summary ..............................................................................................................363
Workshop ............................................................................................................364
Q&A ..............................................................................................................364
Quiz ................................................................................................................365
Quiz Answers..................................................................................................365
Exercises ........................................................................................................366

Day 12 Multimedia: Adding Sounds, Videos, and More 367


Understanding How to Present Sound and Video ..............................................368
The Old Standby: Linking ..................................................................................369
Embedding Sound and Video ..............................................................................378
Using the <embed> Element ............................................................................379
Using the <object> Element ..........................................................................382
Combining <embed> and <object> ................................................................383
Embedding Flash Animations ........................................................................384
Embedding Shockwave Animations ..............................................................384
Embedding RealAudio and RealVideo ..........................................................386
Multimedia Techniques ..................................................................................387
Sound and Video File Types ................................................................................393
Of Plug-Ins and Players ......................................................................................396
Windows Media Player ..................................................................................397
Macromedia Flash ..........................................................................................398
Macromedia Shockwave ................................................................................398
QuickTime 6 by Apple ..................................................................................398
RealOne Player ..............................................................................................399
WinAmp ........................................................................................................400
Summary ..............................................................................................................401
Workshop ............................................................................................................401
Q&A ..............................................................................................................402
Quiz ................................................................................................................402
Quiz Answers..................................................................................................403
Exercises ........................................................................................................403

Part V JavaScript and Dynamic HTML 405

Day 13 JavaScript 407


Introducing JavaScript ........................................................................................408
Why Would You Want to Use JavaScript? ....................................................408
Contents xiii

The <script> Tag ................................................................................................410


The Structure of a JavaScript Script ..............................................................411
The src Attribute ............................................................................................411
Basic Commands and Language Structure..........................................................412
Properties and Methods ..................................................................................413
Events and JavaScript ....................................................................................415
Variables ........................................................................................................417
Operators and Expressions ............................................................................418
Basic JavaScript Programming ............................................................................420
What Is a Program? ........................................................................................420
Learn More About Programming in JavaScript ............................................423
Summary ..............................................................................................................424
Workshop ............................................................................................................424
Q&A ..............................................................................................................424
Quiz ................................................................................................................425
Quiz Answers..................................................................................................425
Exercises ........................................................................................................425

Day 14 Working with JavaScript 427


Creating a Random Link Generator ....................................................................427
Validating Forms with JavaScript ........................................................................437
Creating an Image Rollover ................................................................................444
Summary ..............................................................................................................448
Workshop ............................................................................................................449
Q&A ..............................................................................................................449
Quiz ................................................................................................................449
Quiz Answers..................................................................................................449
Exercises ........................................................................................................450

Day 15 Working with Frames and Linked Windows 451


What Are Frames and Who Supports Them? ......................................................452
Working with Linked Windows ..........................................................................453
The <base> Tag ..............................................................................................457
Working with Frames ..........................................................................................458
The <frameset> Tag ......................................................................................460
The <frame> Tag ............................................................................................462
The <noframes> Tag ......................................................................................463
Changing Frame Borders ....................................................................................464
Creating Complex Framesets ..............................................................................466
Magic target Names ....................................................................................479
Floating Frames ..................................................................................................479
Summary ..............................................................................................................482
Workshop ............................................................................................................484
xiv Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Q&A ..............................................................................................................484
Quiz ................................................................................................................484
Quiz Answers..................................................................................................485
Exercises ........................................................................................................485

Day 16 Using Dynamic HTML 487


What Exactly Is Dynamic HTML?......................................................................488
Using the Document Object Model ....................................................................490
DOM Data Types............................................................................................490
Objects in the DOM ......................................................................................491
Using the DOM ..............................................................................................492
Coping with Reality: Cross-Browser DHTML Techniques ................................496
Sniffing for Browsers ....................................................................................497
Detecting Capabilities ....................................................................................499
Testing for the Existence of Objects ..............................................................500
Grouping Elements with <div>............................................................................500
Positioning <div> Elements ..........................................................................501
Manipulating Elements with JavaScript ........................................................505
Continuing Your DHTML Education ..................................................................513
Summary ..............................................................................................................513
Workshop ............................................................................................................514
Q&A ..............................................................................................................514
Quiz ................................................................................................................515
Quiz Answers..................................................................................................515
Exercise ..........................................................................................................515

Part VI Designing Effective Web Pages 517

Day 17 Writing Good Web Pages: Do’s and Don’ts 519


Standards Compliance ........................................................................................520
Validating Your Pages ....................................................................................523
HTML Tidy ....................................................................................................525
Writing for Online Publication ............................................................................525
Write Clearly and Be Brief ............................................................................525
Organize Your Pages for Quick Scanning ......................................................526
Make Each Page Stand on Its Own ................................................................528
Be Careful with Emphasis..............................................................................528
Don’t Use Browser-Specific Terminology ....................................................529
Spell Check and Proofread Your Pages ..........................................................530
Design and Page Layout ......................................................................................530
Use Headings as Headings ............................................................................530
Group Related Information Visually ..............................................................531
Use a Consistent Layout ................................................................................532
Contents xv

Using Links..........................................................................................................533
Use Link Menus with Descriptive Text..........................................................533
Use Links in Text............................................................................................534
Avoid the “Here” Syndrome ..........................................................................535
To Link or Not to Link ..................................................................................536
Using Images ......................................................................................................539
Don’t Overuse Images....................................................................................539
Use Alternatives to Images ............................................................................539
Keep Images Small ........................................................................................540
Watch Out for Assumptions About Your Visitors’ Hardware ........................541
Be Careful with Backgrounds and Link Colors ............................................542
Other Good Habits and Hints ..............................................................................543
Link Back to Home ........................................................................................543
Don’t Split Topics Across Pages ....................................................................543
Don’t Create Too Many or Too Few Pages ....................................................543
Sign Your Pages ..............................................................................................545
Provide Nonhypertext Versions of Hypertext Pages ......................................547
Summary ..............................................................................................................547
Workshop ............................................................................................................548
Q&A ..............................................................................................................549
Quiz ................................................................................................................549
Quiz Answers..................................................................................................550
Exercises ........................................................................................................550

Day 18 Designing for the Real World 551


What Is the Real World, Anyway? ......................................................................552
Considering User Experience Level ....................................................................553
Add a Search Engine ......................................................................................553
Use Frames Wisely ........................................................................................554
Use Concise, Sensible URLs..........................................................................555
Navigation Provides Context..........................................................................556
Are Your Users Tourists or Regulars? ............................................................557
Determining User Preference ..............................................................................558
Deciding on an HTML 4.01 or XHTML 1.0 Approach......................................559
HTML 4.01 and XHTML 1.0 Transitional ....................................................559
HTML 4.01 and XHTML 1.0 Frameset ........................................................563
HTML 4.01 and XHTML 1.0 Strict ..............................................................564
Summary ..............................................................................................................568
Workshop ............................................................................................................568
Q&A ..............................................................................................................568
Quiz ................................................................................................................569
Quiz Answers..................................................................................................569
Exercises ........................................................................................................570
xvi Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Day 19 Creating Accessible Sites 571


What Is Accessibility? ........................................................................................572
Common Myths Regarding Accessibility ......................................................572
Section 508 ....................................................................................................573
Alternative Browsers............................................................................................573
Writing Accessible HTML ..................................................................................574
Tables..............................................................................................................574
Links ..............................................................................................................575
Images ............................................................................................................576
Designing for Accessibility..................................................................................577
Using Color ....................................................................................................578
Fonts ..............................................................................................................578
Take Advantage of All HTML Tags ..............................................................578
Frames and Linked Windows ........................................................................579
Forms ..............................................................................................................579
Validating Your Sites for Accessibility ................................................................579
Further Reading ..................................................................................................581
Summary ..............................................................................................................581
Workshop ............................................................................................................582
Q&A ..............................................................................................................582
Quiz ................................................................................................................582
Quiz Answers..................................................................................................582
Exercises ........................................................................................................582

Part VII Going Live on the Web 583

Day 20 Putting Your Site Online 585


What Does a Web Server Do? ............................................................................586
Other Things Web Servers Do........................................................................586
Locating a Web Server ........................................................................................588
Using a Web Server Provided by Your School or Work ................................588
Using a Commercial Internet or Web Service................................................588
Setting Up Your Own Server ..........................................................................589
Organizing Your HTML Files for Installation ....................................................589
Questions to Ask Your Webmaster ................................................................590
Keeping Your Files Organized with Directories ............................................591
Having a Default Index File and Correct Filenames......................................591
Publishing Your Files ..........................................................................................592
Moving Files Between Systems ....................................................................593
Troubleshooting ..................................................................................................596
I Can’t Access the Server ..............................................................................596
I Can’t Access Files........................................................................................597
I Can’t Access Images ....................................................................................597
Contents xvii

My Links Don’t Work ....................................................................................598


My Files Are Being Displayed Incorrectly ....................................................598
Registering and Advertising Your Web Pages ....................................................598
Getting Links from Other Sites ......................................................................599
Yahoo! ............................................................................................................599
dmoz: The Open Directory Project ................................................................601
Yellow Pages Listings ....................................................................................602
Private Directories ..........................................................................................603
Site Indexes and Search Engines ........................................................................603
Google ............................................................................................................604
AltaVista ........................................................................................................605
AlltheWeb.com ..............................................................................................605
Submission Tools ................................................................................................606
Web Rings............................................................................................................606
Business Cards, Letterhead, Brochures, and Advertisements ............................607
How to Win Friends and Influence People..........................................................607
Finding Out Who’s Viewing Your Web Pages ....................................................608
Log Files ........................................................................................................608
Access Counters ............................................................................................609
Summary ..............................................................................................................610
Workshop ............................................................................................................610
Q&A ..............................................................................................................610
Quiz ................................................................................................................611
Quiz Answers..................................................................................................611
Exercises ........................................................................................................612

Day 21 Taking Advantage of the Server 613


Web Applications ................................................................................................614
CGI ................................................................................................................614
Active Server Pages........................................................................................616
JSP/J2EE ........................................................................................................618
PHP ................................................................................................................621
Server-Side Includes ............................................................................................622
Using Server-Side Includes ............................................................................623
Using Apache Access Control Files ....................................................................625
Managing Access to Pages ............................................................................626
Redirecting Users ..........................................................................................628
Summary ..............................................................................................................630
Workshop ............................................................................................................630
Q&A ..............................................................................................................630
Quiz ................................................................................................................631
Quiz Answers..................................................................................................631
Exercises ........................................................................................................632
xviii Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Part VIII Appendixes 633

Appendix A Sources for Further Information 635


Access Counters ..................................................................................................636
Browsers ..............................................................................................................637
Collections of HTML and Web Development Information ................................638
Forms and Imagemaps ........................................................................................639
HTML Editors and Converters ............................................................................639
HTML Validators, Link Checkers, and Simple Spiders ......................................640
Java, JavaScript, and Embedded Objects ............................................................641
Log File Parsers ..................................................................................................641
HTML Style Guides ............................................................................................642
Servers and Server Administration ......................................................................642
Sound and Video ..................................................................................................642
Specifications for HTML, HTTP, and URLs ......................................................643
The Common Gateway Interface (CGI) and CGI Scripting................................644
Other Web-Related Topics ..................................................................................644
Tools and Information for Images ......................................................................645
Web Providers ......................................................................................................645
Web Indexes and Search Engines ........................................................................646

Appendix B HTML 4.01 Quick Reference 647


Common Attributes and Events ..........................................................................649
%coreattrs ....................................................................................................649
%i18n ..............................................................................................................649
%events ..........................................................................................................650
Structure ..............................................................................................................650
<bdo>...</bdo> ..............................................................................................650
<body>...</body> ..........................................................................................650
Comments <!-- .. --> ................................................................................651
<div>...</div> ..............................................................................................651
<!DOCTYPE...> ................................................................................................652
<h1>...</h1> Through <h6>...</h6> ..........................................................652
<head>...</head> ..........................................................................................653
<hr> ................................................................................................................653
<html>...</html> ..........................................................................................653
<meta> ............................................................................................................654
<span>...</span> ..........................................................................................654
<title>...</title> ......................................................................................655
Text Phrases and Paragraphs................................................................................655
<acronym>...</acronym> ..............................................................................655
<address>...</address> ..............................................................................655
<blockquote>...</blockquote> ....................................................................655
Contents xix

<br> ................................................................................................................656
<cite>...</cite> ..........................................................................................656
<code>...</code> ..........................................................................................656
<del>...</del> ..............................................................................................656
<dfn>...</dfn> ..............................................................................................657
<em>...</em> ..................................................................................................657
<ins>...</ins> ..............................................................................................657
<kbd>...</kbd> ..............................................................................................658
<p>...</p> ....................................................................................................658
<pre>...</pre> ..............................................................................................658
<q>...</q> ....................................................................................................658
<samp>...</samp> ..........................................................................................659
<strong>...</strong> ..................................................................................659
<sub>...</sub> ..............................................................................................659
<sup>...</sup> ..............................................................................................659
<var>...</var> ..............................................................................................659
Text Formatting Elements....................................................................................660
<b>...</b> ....................................................................................................660
<basefont> ....................................................................................................660
<big>...</big> ..............................................................................................660
<font>...</font> ..........................................................................................661
<i>...</i> ....................................................................................................661
<s>...</s> ....................................................................................................661
<small>...</small> ......................................................................................661
<strike>...</strike> ..................................................................................662
<tt>...</tt> ..................................................................................................662
<u>...</u> ....................................................................................................662
Lists......................................................................................................................662
<dd>...</dd> ..................................................................................................662
<dir>...</dir> ..............................................................................................663
<dl>...</dl> ..................................................................................................663
<dt>...</dt> ..................................................................................................663
<li>...</li> ..................................................................................................664
<menu>...</menu> ..........................................................................................664
<ol>...</ol> ..................................................................................................664
<ul>...</ul> ..................................................................................................665
Links ....................................................................................................................665
<a>...</a> ....................................................................................................665
<base> ............................................................................................................666
<link> ............................................................................................................666
Tables ..................................................................................................................667
<caption>...</caption> ..............................................................................667
<col> ..............................................................................................................667
xx Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

<colgroup>...</colgroup> ..........................................................................668
<table>...</table> ......................................................................................669
<tbody>...</tbody> ......................................................................................669
<td>...</td> ..................................................................................................670
<tfoot>...</tfoot> ......................................................................................671
<th>...</th> ..................................................................................................671
<thead>...</thead> ......................................................................................672
<tr>...</tr> ..................................................................................................672
Frames..................................................................................................................673
<frame> ..........................................................................................................673
<frameset>...</frameset> ..........................................................................674
<iframe>...</iframe> ..................................................................................674
<noframes>...</noframes> ..........................................................................675
Embedded Content ..............................................................................................675
<applet>...</applet> ..................................................................................675
<area> ............................................................................................................676
<img> ..............................................................................................................677
<map>...</map> ..............................................................................................677
<object>...</object> ..................................................................................678
<param> ..........................................................................................................679
Style ....................................................................................................................679
<style>...</style> ......................................................................................679
Forms ..................................................................................................................680
<button>...</button> ..................................................................................680
<fieldset>...</fieldset> ..........................................................................680
<form>...</form> ..........................................................................................680
<input> ..........................................................................................................681
<isindex> ......................................................................................................682
<label>...</label> ......................................................................................683
<legend>...</legend> ..................................................................................683
<option>...</option> ..................................................................................683
<select>...</select> ..................................................................................684
<textarea>...</textarea> ..........................................................................684
Scripts ..................................................................................................................685
<script>...</script> ..................................................................................685
<noscript>...</noscript> ..........................................................................686
Character Entities ................................................................................................686

Appendix C Cascading Style Sheet Quick Reference 693


How to Use This Appendix..................................................................................694
Block-Level Properties ........................................................................................696
bottom, left, right, top ................................................................................696
direction ......................................................................................................696
display ..........................................................................................................696
Contents xxi

float ..............................................................................................................697
position ........................................................................................................697
unicode-bidi ..................................................................................................697
z-index ..........................................................................................................698
Background and Color Properties........................................................................698
background ....................................................................................................698
background-attachment ................................................................................699
background-color ..........................................................................................699
background-image ..........................................................................................699
background-position ....................................................................................700
background-repeat ........................................................................................700
color ..............................................................................................................700
Box Model Properties ..........................................................................................701
border ............................................................................................................701
border-bottom, border-left, border-right, border-top ............................701
border-color ..................................................................................................702
border-bottom-colort, border-left-color, border-right-color,
border-top-color........................................................................................702
border-style ..................................................................................................702
border-bottom-style, border-left-style, border-right-style,
border-top-style........................................................................................703
border-width ..................................................................................................703
border-bottom-width, border-left-width, border-right-width,
border-top-width........................................................................................704
clear ..............................................................................................................704
height, width ................................................................................................704
margin ............................................................................................................705
margin-bottom, margin-left, margin-right, margin-top ............................705
max-height, max-width ..................................................................................705
min-height, min-width ..................................................................................706
padding ..........................................................................................................706
padding-top, padding-right, padding-bottom, padding-left ....................706
Font Properties ....................................................................................................707
font ................................................................................................................707
font-family....................................................................................................707
font-size ......................................................................................................708
font-size-adjust ..........................................................................................708
font-stretch ..................................................................................................708
font-style ....................................................................................................709
font-variant ..................................................................................................709
font-weight....................................................................................................709
List Properties ......................................................................................................710
list-style ....................................................................................................710
list-style-image ..........................................................................................710
xxii Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

list-style-position ....................................................................................711
list-style-type ............................................................................................711
Text Properties ....................................................................................................711
letter-spacing ..............................................................................................711
line-height....................................................................................................712
text-align ....................................................................................................712
text-decoration ............................................................................................712
text-indent....................................................................................................713
text-shadow....................................................................................................713
text-transform ..............................................................................................713
vertical-align ..............................................................................................713
white-space....................................................................................................714
word-spacing ..................................................................................................714
Visual Effects Properties......................................................................................714
clip ................................................................................................................714
overflow ........................................................................................................715
visibility ....................................................................................................715
Aural Style Sheet Properties................................................................................715
azimuth ..........................................................................................................715
cue ..................................................................................................................716
cue-after, cue-before ..................................................................................716
elevation ......................................................................................................716
pause ..............................................................................................................717
pause-after, pause-before ..........................................................................717
pitch ..............................................................................................................717
pitch-range....................................................................................................718
play-during....................................................................................................718
richness ........................................................................................................718
speak ..............................................................................................................718
speak-header ..................................................................................................719
speak-numeral ................................................................................................719
speak-punctuation ........................................................................................719
speech-rate....................................................................................................719
stress ............................................................................................................720
voice-family ..................................................................................................720
volume ............................................................................................................720
Generated Content/Automatic Numbering Properties ........................................721
content ..........................................................................................................721
counter-increment ........................................................................................721
counter-reset ................................................................................................721
marker-offset ................................................................................................722
quotes ............................................................................................................722
Paged Media Properties ......................................................................................722
marks ..............................................................................................................722
Contents xxiii

orphans ..........................................................................................................723
page................................................................................................................723
page-break-after, page-break-before ........................................................723
page-break-inside ........................................................................................724
size ................................................................................................................724
widows ............................................................................................................724
Table Properties ..................................................................................................724
border-collapse ............................................................................................724
border-spacing ..............................................................................................725
caption-side ..................................................................................................725
column-span, row-span ..................................................................................725
empty-cells....................................................................................................726
table-layout ..................................................................................................726
User Interface Properties ....................................................................................726
cursor ............................................................................................................726
outline ..........................................................................................................727
outline-color ................................................................................................727
outline-style ................................................................................................727
outline-width ................................................................................................728
Cascading Style Sheet Units................................................................................728
<absolute-size> ............................................................................................728
<angle> ..........................................................................................................728
<border-style> ..............................................................................................729
<border-width> ..............................................................................................729
<color> ..........................................................................................................729
<family-name> ................................................................................................730
<frequency>....................................................................................................730
<generic-family> ..........................................................................................730
<generic-voice> ............................................................................................730
<integer> ......................................................................................................731
<length> ........................................................................................................731
<number> ........................................................................................................731
<percentage> ..................................................................................................731
<relative-size> ............................................................................................731
<shape> ..........................................................................................................732
<specific-voice> ..........................................................................................732
<time> ............................................................................................................732
<uri> ..............................................................................................................732

Appendix D Colors by Name and Hexadecimal Value 733

Appendix E MIME Types and File Extensions 737

Index 741
About the Authors
LAURA LEMAY is a technical writer, author, Web addict, and motorcycle enthusiast. One
of the world’s most popular authors on Web development topics, she is the author of
Sams Teach Yourself Web Publishing with HTML, Sams Teach Yourself Java in 21 Days,
and Sams Teach Yourself Perl in 21 Days. You can visit her home page at
http://www.lne.com/lemay/.

RAFE COLBURN is a Web application developer and author living in North Carolina. His
other books include Sams Teach Yourself CGI in 24 Hours and Special Edition Using
SQL. If you’d like to read more of his writings, check out his home page at
http://rc3.org/.
Dedication
For my aunt Pauline. You are in my thoughts.

Acknowledgments
To Sams Publishing, for letting me write the kind of HTML book I wanted to see.
To the Coca-Cola Company, for creating Diet Coke and selling so much of it to me.
To all the folks on the comp.infosystems.www newsgroups, the www-talk mailing list, and
the Web conference on the WELL, for answering questions and putting up with my late-
night rants.
To innumerable people who helped me with the writing of this book, including Lance
Norskog, Ken Tidwell, Steve Krause, Tony Barreca, CJ Silverio, Peter Harrison, Bill
Whedon, Jim Graham, Jim Race, Mark Meadows, and many others I’m sure I’ve
forgotten.
Finally, to Eric Murray, the other half of lne.com, for moral support when I was con-
vinced I couldn’t possibly finish writing any of this book on time, for setting up all my
UNIX and networking equipment and keeping it running, and for writing a whole lot of
Perl code on very short notice.
—Laura Lemay
One of the toughest parts of a book to write is the acknowledgements because deserving
people always get left out, and the printed words are rarely enough to properly express
the author’s gratitude.
I really want to thank the excellent people at Sams Publishing who gave me the opportu-
nity to work on this book, and who supported me as I worked on it. Betsy Brown, Mark
Taber, George Nedeff, Mike Henry, and particularly Jon Steever are all deserving of
praise.
Also, much thanks to Jason Perkins, who did an admirable job as the technical editor of
this book.
—Rafe Colburn
Tell Us What You Think!
As the reader of this book, you are our most important critic and commentator. We value
your opinion and want to know what we’re doing right, what we could do better, what
areas you’d like to see us publish in, and any other words of wisdom you’re willing to
pass our way.
You can email or write me directly to let me know what you did or didn’t like about this
book—as well as what we can do to make our books stronger.
Please note that I cannot help you with technical problems related to the topic of this
book, and that due to the high volume of mail I receive, I might not be able to reply to
every message.
When you write, please be sure to include this book’s title and author as well as your
name and phone number or email address. I will carefully review your comments and
share them with the author and editors who worked on the book.
Email: webdev@samspublishing.com
Mail: Mark Taber
Associate Publisher
Sams Publishing
800 East 96th Street
Indianapolis, IN 46240 USA
Introduction
Over the past few years, the Web has become completely integrated into the fabric of
society. Most businesses have Web sites, and it’s rare to see a commercial on television
that doesn’t display a URL. The simple fact that most people now know what a URL is
speaks volumes. People who didn’t know what the Internet was several years ago are
now sending me invitations to parties using Web-based invitation services.
Perhaps the greatest thing about the Web is that you don’t have to be a big company to
publish things on it. The only things you need to create your own Web site are a com-
puter with access to the Internet and the willingness to learn. Obviously, the reason
you’re reading this is that you have an interest in Web publishing. Perhaps you need to
learn about it for work, or you’re looking for a new means of self-expression, or you
want to post baby pictures on the Web so that your relatives all over the country can stay
up to date. The question is, how do you get started?
There’s more than enough information on the Web about how to publish Web sites like a
seasoned professional. There are tutorials, reference sites, tons of examples, and free
tools to make it easier to publish on the Web. However, the advantage of reading this
book instead is that all the information you need to build Web sites is organized in one
place and presented in an orderly fashion. It has everything you need to master HTML,
publish sites to a server on the Web, create graphics for use on the Web, and keep your
sites running smoothly.
But wait, there’s more. Other books on how to create Web pages just teach you the basic
technical details, such as how to produce a boldface word. In this book, you’ll also learn
why you should be producing a particular effect and when you should use it. In addition,
this book provides hints, suggestions, and examples of how to structure your overall Web
site, not just the words on each page. This book won’t just teach you how to create a
Web site—it’ll teach you how to create a good Web site.
Also, unlike other books on this subject, this book doesn’t focus on any one platform.
Regardless of whether you’re using a PC running Windows, a Macintosh, some flavor of
UNIX, or any other computer system, many of the concepts in this book will be valuable
to you. And you’ll be able to apply them to your Web pages regardless of your platform
of choice.
2 Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

Who Should Read This Book


Is this book for you? That depends:
• If you’ve seen what’s out on the Web and you want to contribute your own content,
this book is for you.
• If you work for a company that wants to create a Web site and you’re not sure
where to start, this book is for you.
• If you’re an information developer, such as a technical writer, and you want to
learn how the Web can help you present your information online, this book is for
you.
• If you’re just curious about how the Web works, some parts of this book are for
you, although you might be able to find what you need on the Web itself.
• If you’ve created Web pages before with text, images, and links, and you’ve played
with a table or two and set up a few simple forms, you may be able to skim the
first half of the book. The second half should still offer you a lot of helpful infor-
mation.
If you’ve never seen the Web before but you’ve heard that it’s really nifty, this book isn’t
for you. You’ll need a more general book about the Web before you can produce Web
sites yourself.

What This Book Contains


This book is intended to be read and absorbed over the course of 21 days (although it
depends on how much you can absorb in a day). On each day you’ll read one lesson on
one area of Web site design. The lessons are arranged in a logical order, taking you from
the simplest tasks to more advanced techniques.
Part I: Getting Started
In Part I, you’ll get a general overview of the World Wide Web and what you can do with
it, and then you’ll come up with a plan for your Web presentation. You’ll also write your
first (very basic) Web page.
Part II: Creating Simple Web Pages
In Part II, you’ll learn how to write simple documents in the HTML language and link
them together using hypertext links. You’ll also learn how to format your Web pages and
how to use images on your pages.
Introduction 3

Part III: Doing More with HTML and XHTML


In Part III, you’ll learn how to create tables and forms and place them on your pages.
You’ll also learn how to use cascading style sheets to describe how your pages are for-
matted instead of tags that are focused strictly on formatting.
Part IV: Graphics and Multimedia
In Part IV, you’ll learn how to go beyond placing simple static images on your pages.
You’ll learn how to use image maps to include several links within a single image, and
how to create and use animated GIFS. You’ll also learn about how multimedia (audio,
video, and other complex media types) works in the context of the Web.
Part V: JavaScript and Dynamic HTML
In Part V, we’ll look at how you can extend the functionality of your Web pages by
adding JavaScript to them. First, I’ll provide an overview of JavaScript, and then I’ll pro-
vide some specific JavaScript examples you can use on your own pages. Finally, I’ll
describe how you can dynamically modify the look and feel of your pages using
Dynamic HTML.
Part VI: Designing Effective Web Pages
Part VI will give you some hints for creating a well-constructed Web site, and you’ll
explore some sample Web sites to get an idea of what sort of work you can do. You’ll
learn how to design pages that will reach the types of real-world users you want to reach,
and you’ll learn how to create an accessible site that is usable by people with disabilities.
Part VII: Going Live on the Web
In Part VII, you’ll learn how to put your site up on the Web, including how to advertise
the work you’ve done. You’ll also learn how to use some of the features of your Web
server to make your life easier.
Part VIII: Appendixes
In the appendixes you’ll find reference information about HTML, Cascading Style
Sheets, the HTML color palette, and common file types on the Web. You’ll also find a
list of useful Web sites that complement the information in the book.

What You Need Before You Start


There are seemingly hundreds of books on the market about how to get connected to the
Internet, and lots of books about how to use the World Wide Web. This book isn’t one
of them. I’m assuming that if you’re reading this book, you already have a working
4 Sams Teach Yourself Web Publishing with HTML and XHTML in 21 Days

connection to the Internet, you have a Web browser such as Microsoft Internet Explorer
or Netscape, and you’ve used it at least a couple of times. You should also have at least a
passing acquaintance with some other elements of the Internet, such as electronic mail
and Usenet news, because I refer to them in general terms in this book.
In other words, you need to have used the Web in order to provide content for the Web. If
you meet this one simple qualification, read on!

Note To really take advantage of all the concepts and examples in this book, you
should consider using the most recent version of Microsoft Internet Explorer
(version 6.0 or later) or Netscape (version 7.0 or later).

Conventions Used in This Book


This book uses special typefaces and other graphical elements to highlight different types
of information.

Special Elements
Three types of “boxed” elements present pertinent information that relates to the topic
being discussed: Note, Tip, and Caution. Each item has a special icon associated with it,
as described here.

Note Notes highlight special details about the current topic.

Tip It’s a good idea to read the tips because they present shortcuts or trouble-
saving ideas for performing specific tasks.

Caution Don’t skip the cautions. They help you avoid making decisions or performing
actions that can cause you trouble.
Introduction 5

HTML Input and Output Examples


Throughout the book, I’ll present exercises and examples of HTML input and output.
An input icon identifies HTML code that you can type in yourself.
INPUT

OUTPUT An output icon indicates the results of the HTML input in a Web browser such as
Microsoft Internet Explorer.

Special Fonts
Several items are presented in a monospace font, which can be plain or italic. Here’s
what each one means:
plain mono Applied to commands, filenames, file extensions, directory names,
Internet addresses, URLs, and HTML input. For example, HTML tags such as <TABLE>
and <P> appear in this font.
mono italic Applied to placeholders. A placeholder is a generic item that replaces
something specific as part of a command or computer output. For instance, the term
represented by filename would be the real name of the file, such as myfile.txt.

What’s on the Web Site?


To help you get the most out of this book, there’s a corresponding Web site at
http://www.tywebpub.com/. This site contains the source code and graphics for the exam-
ples used in this book, plus updated information about where to find tools and hints to
help you further develop and expand your Web presentations. Check it out!
PART I
Getting Started
1 The World of the World Wide
Web
2 Get Organized
3 An Introduction to HTML and
XHTML
4 Begin with the Basics
DAY 1
The World of the World
Wide Web
A journey of a thousand miles begins with a single step, and here you are at
Day 1 of a journey that will show you how to write, design, and publish pages
on the World Wide Web. But before beginning the actual journey, you should
start simple, with the basics. You’ll learn the following:
• What the World Wide Web is, and why it’s really cool
• What Web browsers do, and a couple of popular ones from which to
choose
• What a Web server is, and why you need one
• Some information about uniform resource locators (URLs)
If you’ve spent even a small amount of time exploring the Web, most if not all
of today’s information will seem like old news. If so, feel free to skim it and
skip ahead to Day 2, “Get Organized,” where you’ll find an overview of points
to think about when you design and organize your own Web documents.
10 Day 1

What Is the World Wide Web?


Chances are that you’ve used the Web, perhaps even a lot. However, you might not have
done a lot of thinking about how it works under the covers. In this first section, I’m
going to describe the Web at a more theoretical level so that you can understand how
it works as a platform.
I have a friend who likes to describe things using many meaningful words strung
together in a chain so that it takes several minutes to sort out what he’s just said.
If I were he, I’d describe the World Wide Web as a global, interactive, dynamic, cross-
platform, distributed, graphical hypertext information system that runs over the Internet.
Whew! Unless you understand all these words and how they fit together, this description
isn’t going to make much sense. (My friend often doesn’t make much sense, either.)
So, let’s look at all these words and see what they mean in the context of how you use
the Web as a publishing medium.

The Web Is a Hypertext Information System


The idea behind hypertext is that instead of reading text in a rigid, linear structure (such
as a book), you can skip easily from one point to another. You can get more information,
go back, jump to other topics, and navigate through the text based on what interests you
at the time.
Hypertext enables you to read and navigate text and visual information in a non-
NEW TERM
linear way, based on what you want to know next.
When you hear the term hypertext, think links. Whenever you visit a Web page, you’re
almost certain to see links throughout the page. Some of the links might point to loca-
tions within that same page, others to pages on the same site, and still others might point
to content stored on other servers. Hypertext was an old concept when the Web was
invented—it was found in applications such as HyperCard and various help systems.
However, the World Wide Web redefined how large a hypertext system could be. Even
large Web sites were hypertext systems of a scale not before seen, and when you take
into account that it’s no more difficult to link to a document on a server in Australia from
a server in the United States than it is to link to a document stored in the same directory,
the scope of the Web becomes truly staggering.
The World of the World Wide Web 11

Note Nearly all large corporations and medium-sized businesses and organizations
are using Web technology to manage projects, order materials, and distrib- 1
ute company information in a paperless environment. By locating their
documents on a private, secure Web server called an intranet, they take
advantage of the technologies the World Wide Web has to offer while
keeping the information contained within the company.

The Web Is Graphical and Easy to Navigate


In the early days, using the Internet involved simple text-only applications. You had
to navigate the Internet’s various services using typed commands and arcane tools.
Although plenty of information was available on the Net, it wasn’t necessarily pretty
to look at.
Then along came the first graphical Web browser: Mosaic. It paved the way for the Web
to display both text and graphics in full color on the same page. The ability to create
complex, attractive pages rivaling those founds in books, magazines, and newspapers
propelled the popularity of the Web. These days, the Web offers such a wide degree of
capabilities that people are writing Web applications that replace desktop applications.
A browser is used to view and navigate Web pages and other information on the
NEW TERM
World Wide Web. Currently, the most popular browser is Microsoft Internet
Explorer. It’s considered a part of Microsoft Windows and a version of it is also bundled
with Mac OS X.

Note If the Web incorporates so much more than text, why do I keep calling the
Web a hypertext system? Well, if you’re going to be absolutely technically
correct about it, the Web is not a hypertext system—it’s a hypermedia sys-
tem. But, on the other hand, you might argue that the Web began as a text-
only system, and much of the content is still text-heavy, with extra bits of
media added in as emphasis. Many very educated people are arguing these
very points at this moment and presenting their arguments in papers and
discursive rants as educated people like to do. Whatever. I prefer the term
hypertext, and it’s my book, so I’m going to use it. You know what I mean.
12 Day 1

The Web Is Cross-Platform


If you can access the Internet, you can access the World Wide Web, regardless of
whether you’re working on a low-end PC or a fancy expensive workstation. More
recently, people began accessing the Internet through their mobile phones, portable hand-
held PCs, and personal information managers. If you think Windows menus and buttons
look better than Macintosh menus and buttons or vice versa (or if you think both
Macintosh and Windows people are weenies), it doesn’t matter. The World Wide Web
isn’t limited to any one kind of machine or developed by any one company. The Web is
entirely cross-platform.
Cross-platform means that you can access Web information equally well from
NEW TERM
any computer hardware running any operating system using any display.

Note The whole idea that the Web is—and should be—cross-platform is strongly
held to by purists. The reality, however, is somewhat different. With the
introduction over the years of numerous special features, technologies, and
media types, the Web has lost some of its capability to be truly cross-plat-
form. As Web authors choose to use these nonstandard features, they will-
ingly limit the potential audience for the content of their sites. For example,
a site centered around a Java program essentially is unusable for someone
using a browser that doesn’t support Java, or for a user who might have
turned off Java in his browser for quicker downloads. Similarly, some pro-
grams that extend the capabilities of a browser (known as plug-ins) are
available only for one platform (either Windows, Macintosh, or UNIX).
Choosing to use one of those plug-ins makes that portion of your site
unavailable to users who are either on the wrong platform or don’t want
to bother to download and install the plug-in.

The Web Is Distributed


Information can take up a great deal of space, particularly when you include images and
multimedia capabilities. To store all the information, graphics, and multimedia provided
on the Web, you would need an untold amount of disk space, and managing it would be
almost impossible. Imagine that you were interested in finding out more information
about alpacas (Peruvian mammals known for their wool), but when you selected a link in
your online encyclopedia, your computer prompted you to insert CD-ROM #456 ALP
through ALR. You could be there for a long time just looking for the right CD-ROM!
The Web is successful in providing so much information because that information is dis-
tributed globally across thousands of Web sites, each of which contributes the space for
The World of the World Wide Web 13

the information it publishes. These sites reside on one or more computers, referred to as
Web servers. A Web server is just a computer that listens for requests from Web browsers
and responds to that request. You, as a consumer of that information, request a resource
1
from the server to view the information. When you’re done, you go somewhere else, and
your system reclaims the disk space. You don’t have to install it, change disks, or do any-
thing other than point your browser at that site.
A Web site is a location on the Web that publishes some kind of information.
NEW TERM
When you view a Web page, your browser connects to that Web site to get that
information.
Each Web site, and each page or bit of information on that site, has a unique address.
This address is called a uniform resource locator or URL. When people tell you to visit
a site at http://www.coolsite.com/, they’ve just given you a URL. Whenever you use a
browser to visit a Web site, you get there using a URL. You’ll learn more about URLs
later today in “Uniform Resource Locators.”

The Web Is Dynamic


If you want a permanent copy of some information that’s stored on the Web, you have
to save it locally because the publisher (or anyone else with appropriate access to that
server) can go back and change any of that information whenever she wants.
If you’re browsing that information, you don’t have to install a new version of the help
system, buy another book, or call technical support to get updated information. Just
launch your browser and check out what’s there.
If you’re publishing on the Web, you can make sure that your information is up-to-date
all the time. You don’t have to spend a lot of time re-releasing updated documents.
There’s no cost of materials. You don’t have to get bids on numbers of copies or quality
of output. Color is free. And you won’t get calls from hapless customers who have a
version of the book that was obsolete four years ago.
Consider a book published and distributed entirely online, such as Thinking in Java by
Bruce Eckel (which you can find at www.mindview.net/Books/TIJ/). He can correct any
mistakes in the book and simply upload the revised text to his Web site, making it
instantly available to his readers. He can document new features of Java and include
them in the latest version of the book on his site. The Web site for the book appears
in Figure 1.1.
14 Day 1

FIGURE 1.1
The Web site for
Thinking in Java.

Note The pictures throughout this book usually are taken from a Windows
browser. The only reason for this use is that I’m writing this book primarily
on a Windows PC. If you’re using a Macintosh or UNIX system, don’t feel left
out. As I noted earlier, the glory of the Web is that you see the same infor-
mation regardless of the platform you’re using. So, ignore the buttons and
window borders and focus on what’s inside the window.

For some sites, the capability to update the site on the fly, at any moment, is precisely
why the site exists. Figure 1.2 shows the home page for The Nando Times, an online
newspaper that’s updated 24 hours a day to reflect up-to-the-minute news as it happens.
Because the site is up and available all the time, it has an immediacy that neither hard-
copy newspapers nor most television news programs can match. Visit The Nando Times
at http://www.nandotimes.com/.

The Web Is Interactive


Interactivity is the capability to “talk back” to the Web server. More traditional media,
such as television, isn’t interactive at in the slightest; all you do is sit and watch as shows
are played at you. Other than changing the channel, you don’t have much control over
what you see. Add WebTV capability to it, however, and television becomes a new expe-
rience.
The Web is inherently interactive; the act of selecting a link and jumping to another Web
page to go somewhere else on the Web is a form of interactivity. In addition to this
simple interactivity, however, the Web also enables you to communicate with the pub-
lisher of the pages you’re reading and with other readers of those pages.
The World of the World Wide Web 15

FIGURE 1.2
The Nando Times. 1

For example, pages can be designed to contain interactive forms that readers can fill out.
Forms can contain text-entry areas, radio buttons, or simple menus of items. When the
form is submitted, the information typed by readers is sent back to the server from which
the pages originated. Figure 1.3 shows an example of an online form for a rather ridicu-
lous census.

FIGURE 1.3
The Surrealist Census
form.
16 Day 1

As a publisher of information on the Web, you can use forms for many different pur-
poses, such as the following:
• To get feedback about your pages.
• To get information from your readers (survey, voting, demographic, or any other
kind of data). You then can collect statistics on that data, store it in a database,
or do anything you want with it.
• To provide online order forms for products or services available on the Web.
• To create guestbooks and conferencing systems that enable your readers to post
their own information on your pages. These kinds of systems enable your readers
to communicate not only with you, but also with other readers of your pages.
In addition to forms, which provide some of the most popular forms of interactivity on
the Web, advanced features of Web technologies provide even more interactivity. Flash,
JavaScript, Java, and Shockwave, for example, enable you to include entire programs and
games inside Web pages. Software can run on the Web to enable real-time chat sessions
between your readers. As time goes on, the Web becomes less of a medium for people
passively sitting and digesting information (and becoming “Net potatoes”) and more of a
medium for reaching and communicating with other people all over the world.

Web Browsers
A Web browser, as mentioned earlier, is the program you use to view pages and navigate
the World Wide Web. Web browsers sometimes are called Web clients or other fancy
names (Internet navigation tools), but Web browser is the most common term.
A wide array of Web browsers is available for just about every platform you can imagine.
Most browsers are freeware or shareware (try before you buy) or have a lenient licensing
policy. Microsoft Internet Explorer, for example, is included with the Mac OS and
Windows. Mozilla, Netscape Navigator, and Opera are all available for free. Currently,
the most popular browser for the World Wide Web is Microsoft Internet Explorer (some-
times called just Internet Explorer or IE). Despite the fact that Internet Explorer has the
lion’s share of the market, however, it isn’t the only browser on the Web. This point will
become important later, when you learn how to design Web pages and learn about the
diverse capabilities of different browsers. Assuming that Internet Explorer is the only
browser in use on the Web and designing your pages accordingly limits the audience
you can reach with the information you want to present.
The World of the World Wide Web 17

Note Choosing to develop for a specific browser, such as Internet Explorer, is suit-
able when you know a limited audience using the targeted browser soft- 1
ware will view your Web site. Developing this way is a common practice in
corporations implementing intranets. In these situations, it’s a fair assump-
tion that all users in the organization will use the browser supplied to them
and, accordingly, it’s possible to design the Web pages on an intranet to use
the specific capabilities of the browser in question.

What the Browser Does


Any Web browser’s job is twofold. Given a pointer to a piece of information on the Net
(a URL), the browser has to be able to access that information or operate in some way
based on the contents of that pointer. For hypertext Web documents, the browser must be
able to communicate with the Web server. Many browsers can also access stored on FTP
servers as well.
What the browser is best at, however, is dealing with retrieving and displaying Web
documents. Each Web page is a file written in a language called the Hypertext Markup
Language (HTML) that includes the text of the page, its structure, and links to other doc-
uments, images, or other media. The browser takes the information it gets from the Web
server and formats and displays it for your system. Different browsers might format and
display the same file in diverse ways, depending on the capabilities of that system and
how the browser is configured.
Retrieving documents from the Web and formatting them for your system are the two
tasks that make up the core of a browser’s functionality. Depending on the browser you
use and the features it includes, however, you also might be able to play Flash anima-
tions, multimedia files, view and interact with Java applets, read your mail, or use other
advanced features that a particular browser offers.

An Overview of Some Popular Browsers


This section describes the most popular browsers currently on the Web. They’re in no
way the only browsers available, and if the browser you’re using isn’t listed here, don’t
feel that you have to use one of these. Whichever browser you have is fine as long as it
works for you.
18 Day 1

Microsoft Internet Explorer


Microsoft’s browser, Microsoft Internet Explorer, runs on all versions of Windows and
the Mac OS as well. In fact, Internet Explorer is built into all the current versions of
Microsoft Windows. You can still install and use other browsers if you want, but if you’re
not picky, you don’t need to do anything more.

Note If you’re serious about Web design, you should install all the popular
browsers on your system and use them to view your pages after you’ve pub-
lished them. That way, you can make sure that everything is working prop-
erly. Even if you don’t use a particular browser on a day-to-day basis, your
site will be visited by people who do.

Microsoft Internet Explorer has become the most popular Web browser currently in use,
in large part due to the fact that it has been tightly integrated with the latest versions of
Windows. Microsoft releases new versions of its browser more often than Netscape, and
in addition to partial support for most standard Web technologies, Internet Explorer also
includes a number of unique features that were developed by Microsoft. Based on cur-
rent estimates, Internet Explorer has captured more than 90% of the overall browser
market. Figure 1.4 shows Internet Explorer running under Windows XP.

FIGURE 1.4
Microsoft Internet
Explorer (Windows
XP).
Other documents randomly have
different content
was laid out, her toes were bound together, her chin was tied up;
she heard the arrangements for her funeral discussed, and yet she
was unable to make the slightest sign that she was still in the
possession of sense, feeling, and life.
In one form of disease, then, the animal life, both the sensitive and
the motive portions of it, may perish; and in another form of
disease, either the one or the other part of it may be suspended,
while the organic life continues in full operation: it follows that the
two lives, blended as they are, are distinct, since the one is capable
of perishing without immediately and inevitably involving the
destruction of the other.
7. And, finally, as the organic life is the first born, so it is the last to
die; while the animal life, as it is the latest born, and the last to
attain its full development, so it is the earliest to decline and the first
to perish. In the process of natural death, the extinction of the
animal is always anterior to that of the organic life. Real death is a
later, and sometimes a much later event than apparent death. An
animal appears to be dead when, together with the abolition of
sensation and the loss of voluntary motion, respiration, circulation,
and the rest of the organic functions can no longer be distinguished;
but these functions go on some time after they have ceased to
afford external indications of their action. In man, and the
warmblooded animals in general, suspension or submersion
extinguishes the animal life, at the latest, within the space of four
minutes from the time that the atmospheric air is completely
excluded from the lung; but did the organic functions also cease at
the same period, it would be impossible to restore an animal to life
after apparent death from drowning and the like. But however
complete and protracted the abolition of the animal functions, re-
animation is always possible as long as the organic organs are
capable of being restored to their usual vigour. The cessation of the
animal life is but the first stage of death, from which recovery is
possible; death is complete only when the organic together with the
animal functions have wholly ceased, and are incapable of being re-
established.
In man, the process of death is seldom altogether natural. It is
generally rendered premature by the operation of circumstances
which destroy life otherwise than by that progressive and slow decay
which is the inevitable result of the action of organized structure.
Death, when natural, is the last event of an extended series, of
which the first that is appreciable is a change in the animal life and
in the noblest portion of that life. The higher faculties fail in the
reverse order of their development; the retrogression is the inverse
of the progression, and the noblest creature, in returning to the
state of non-existence, retraces step by step each successive stage
by which it reached the summit of life.
In the advancing series, the animal is superadded to the organic life;
sensation, the lowest faculty of the animal life, precedes
ratiocination, the highest. The senses called into play at the moment
of birth soon acquire the utmost perfection of which they are
capable; but the intellectual faculties, later developed, are still later
perfected, and the highest the latest.
In the descending series, the animal life fails before the organic, and
its nobler powers decay sooner and more rapidly than the
subordinate. First of all, the impressions which the organs of sense
convey to the brain become less numerous and distinct, and
consequently the material on which the mind operates is less
abundant and perfect; but at the same time, the power of working
vigorously with the material it possesses more than proportionally
diminishes. Memory fails; analogous phenomena are less readily and
less completely recalled by the presence of those which should
suggest the entire train; the connecting links are dimly seen or
wholly lost; the train itself is less vivid and less coherent; train
succeeds train with preternatural slowness, and the consequence of
these growing imperfections is that, at last, induction becomes
unsound just as it was in early youth; and for the same reason,
namely, because there is not in the mental view an adequate range
of individual phenomena; the only difference being that the range
comprehended in the view of the old man is too narrow, because
that which he had learnt he has forgotten; while in the youth it is
too narrow, because that which it is necessary to learn has not been
acquired.
And with the diminution of intellectual power the senses continue
progressively to fail: the eye grows more dim, the ear more dull, the
sense of smell less delicate, the sense of touch less acute, while the
sense of taste immediately subservient to the organic function of
nutrition is the last to diminish in intensity and correctness, and
wholly fails but with the extinction of the life it serves.
But the senses are not the only servants of the brain; the voluntary
muscles are so equally; but these ministers to the master-power, no
longer kept in active service, the former no longer employed to
convey new, varied, and vivid impressions, the latter no longer
employed to execute the commands of new, varied, and intense
desires, become successively feebler, slower, and more uncertain in
their action. The hand trembles, the step totters, and every
movement is tardy and unsteady. And thus, by the loss of one
intellectual faculty after another, by the obliteration of sense after
sense, by the progressive failure of the power of voluntary motion;
in a word, by the declining energy and the ultimate extinction of the
animal life, man, from the state of maturity, passes a second time
through the stage of childhood back to that of infancy; lapses even
into the condition of the embryo: what the fœtus was, the man of
extreme old age is: when he began to exist, he possessed only
organic life; and before he is ripe for the tomb, he returns to the
condition of the plant.
And even this merely organic existence cannot be long maintained.
Slow may be the waste of the organic organs; but they do waste,
and that waste is not repaired, and consequently their functions
languish, and no amount of stimulus is capable of invigorating their
failing action. The arteries are rigid and cannot nourish; the veins
are relaxed and cannot carry on the mass of blood that oppresses
them; the lungs, partly choked up by the deposition of adventitious
matter, and partly incapable of expanding and collapsing by reason
of the feeble action of the respiratory apparatus, imperfectly aërate
the small quantity of blood that flows through them; the heart,
deprived of its wonted nutriment and stimulus, is unable to contract
with the energy requisite to propel the vital current; the various
organs, no longer supplied with the quantity and quality of material
necessary for carrying on their respective processes, cease to act;
the machinery stops, and this is death.
And now the processes of life at an end, the body falls within the
dominion of the powers which preside universally over matter; the
tie that linked all its parts together, holding them in union and
keeping them in action, in direct opposition to those powers
dissolved, it feels and obeys the new attractions to which it has
become subject; particle after particle that stood in beautiful order
fall from their place; the wonderful structures they composed melt
away; the very substances of which those structures were built up
are resolved into their primitive elements; these elements, set at
liberty, enter into new combinations, and become constituent parts
of new beings; those new beings in their turn perish; from their
death springs life, and so the changes go on in an everlasting circle.
As far as relates to the organized structures in which life has its seat,
and to the operations of life dependent on those structures, such is
its history; a history not merely curious, but abounding with practical
suggestions of the last importance. The usefulness of a familiar
acquaintance with the phenomena which have now been elucidated
will be apparent at every step as we proceed.
CHAPTER III.
Ultimate object of organization and life—Sources of pleasure—
Special provision by which the organic organs influence
consciousness and afford pleasure—Point at which the organic
organs cease to affect consciousness, and why—The animal
appetites: the senses: the intellectual faculties: the selfish and
sympathetic affections: the moral faculty—Pleasure the direct,
the ordinary, and the gratuitous result of the action of the
organs—Pleasure conducive to the development of the organs,
and to the continuance of their action—Progress of human
knowledge—Progress of human happiness.

The object of structure is the production of function. Of the two


functions combined in the living animal, one is wholly subservient to
the other. To build up the apparatus of the animal life, and to
maintain it in a condition fit for performing its functions, is the sole
object of the existence of the organic life. What then is the object of
the animal life? That object, whatever it be, must be the ultimate
end of organization, and of all the actions of which it is the seat and
the instrument.
Two functions, sensation and voluntary motion, are combined in the
animal life. Of these two functions, the latter is subservient to the
former: voluntary motion is the servant of sensation, and exists only
to obey its commands.
Is sensation, then, the ultimate object of organization? Simple
sensation cannot be an ultimate object, because it is invariably
attended with an ultimate result; for sensation is either pleasurable
or painful. Every sensation terminates in a pleasure or a pain.
Pleasure or pain, the last event in the series, must then be the final
end.
Is the production of pain the ultimate object of organization? That
cannot be, for the production of pain is the indirect, not the direct,—
the extraordinary, not the ordinary, result of the actions of life. It
follows that pleasure must be the ultimate object, for there is no
other of which it is possible to conceive. The end of organic
existence is animal existence; the end of animal existence is sentient
existence; the end of sentient existence is pleasurable existence; the
end of life therefore is enjoyment. Life commences with the organic
processes; to the organic are superadded the animal; the animal
processes terminate in sensation; sensation ends in enjoyment; it
follows, that enjoyment is the final end. For this every organ is
constructed; to this every action of every organ is subservient; in
this every action ultimately terminates.
And without a single exception in the entire range of the sentient
creation, the higher the organized structure the greater the
enjoyment, mediately or immediately, to which it is subservient.
From its most simple to its most complex state, every successive
addition to structure, by which function is rendered more elevated
and perfect, proportionally increases the exquisiteness of the
pleasure to which the function ministers, and in which it terminates.
Pleasure is the result of the action of living organs, whether organic
or animal; pleasure is the direct, the ordinary, and the gratuitous
result of the action of both sets of organs; the pleasure resulting
from the action of the organs is conducive to their complete
development, and thereby to the increase of their capacity for
affording enjoyment; the pleasure resulting from the action of the
organs, and conducive to their development, is equally conducive to
the perpetuation of their action, and consequently to the
maintenance of life; it follows not only that enjoyment is the end of
life, but that it is the means by which life is prolonged. Of the truth
of each of these propositions, it will be interesting to contemplate
the plenitude of the proof.
1. In the first place, pleasure is the result of the action of the
organic organs. It has indeed been shown that the very character by
which the action of these organs is distinguished is that they are
unattended with consciousness. Nevertheless, by a special provision,
consciousness is indirectly connected with the processes of this
class, limited in extent indeed, and uniformly terminating at a certain
point; but the extent and the limitation alike conducing to the
pleasurableness of its nature. And this is an adjustment in the
constitution of our frame which is well deserving of attention.
Organic processes are dependent on a peculiar influence derived
from that portion of the nervous system distinguished by the term
organic. The organic nerves, distributed to the organic organs, take
their origin and have their chief seat in the cavities that contain the
main instruments of the organic life, namely, the chest and abdomen
(see chap. v.). As will be fully shown hereafter, these nerves
encompass the great trunks of the blood-vessels that convey arterial
blood to the organic organs. In all its ramifications through an
organic organ, an arterial vessel is accompanied by its organic
nerve; so that wherever the capillary arterial branch goes, secreting
or nourishing, there goes, inseparably united with it, an organic
nerve, exciting and governing.
Among the peculiarities of this portion of the nervous system, one of
the most remarkable is, that it is wholly destitute of feeling.
Sensibility is inseparably associated with the idea commonly formed
of a nerve. But the nervous system consists of two portions, one
presiding over sensation and voluntary motion, hence called the
sentient and the motive portions; the other destitute of sensation,
but presiding over the organic processes, hence called the organic
portion. If the communication between the organic organ and the
organic nerve be interrupted, the function of the organ, whatever it
be, is arrested. Without its organic nerves, the stomach cannot
secrete gastric juice; the consequence is, that the aliment is
undigested. Without its organic nerves, the liver cannot secrete bile,
the consequence is, that the nutritive part of the aliment is incapable
of being separated from its excrementitious portion. The organic
organ receives from its organic nerve an influence, without which it
cannot perform its function; but the nerve belonging to this class
neither feels nor communicates feeling, and hence it imparts no
consciousness of the operation of any process dependent upon it.
Yet there is not one of these processes that does not exert a most
important influence over consciousness. How? By a special provision,
as curious in its nature as it is important in its result.
Branches of sentient nerves are transmitted from the animal to the
organic system, and from the organic to the animal; and an intimate
communication is established between the two classes. The
inspection of fig. XVI. will illustrate the mode in which this
communication is effected. A B represents a portion of the spinal
cord (one of the central masses of the sentient system), covered
with its membranes. The part here represented is a front view of
that portion of the spinal cord which belongs to the back, and which
is technically called the dorsal portion.
1, 2, 3, 4, 5, 6, 7, 8, 9, the second, &c. ribs with the corresponding
dorsal (sentient) nerves, a, b, c, d, e, f, g, h, going out to supply
their respective organs with sensation.
C D E, a portion of the main trunk of the organic (non-sentient)
nerve, commonly called the Great Sympathetic.
F G H, the membrane of the spinal cord cut open and exposing I K,
the spinal cord itself, L, the anterior branch of one of the dorsal
nerves, arising from the anterior surface of the spinal cord by several
bundles of fibres.
M, the posterior branch of the same nerve, arising in like manner
from the posterior surface of the spinal cord by several branches of
fibres.
The anterior and posterior branches uniting to form one trunk N.
Two branches, P Q, sent off from the spinal (sentient) trunk to unite
with the organic (non-sentient) trunk.
R S T U V W, other branches of the sentient, connected with the
branches of the non-sentient nervous trunks in the same mode.
X Y, the main trunk of the sympathetic (non-sentient) nerve cut
across and turned aside, in order that the parts beneath it (P N) may
be more distinctly seen.
From this description, it is apparent that each sentient nerve, before
it goes out to the animal organs, to which it is destined to
communicate sensation, sends off two branches to the organic or
the non-sentient. These sentient nerves mix and mingle with the
insensible nerves; accompany them in their course to the organic
organs, and ramify with them throughout their substance. It is
manifest, then, that sentient nerves, that nerves not necessary to
the organic processes, having, as far as is known, nothing whatever
to do with those processes, enter as constituent parts into the
composition of the organic organs. What is the result? That organic
organs are rendered sentient; that organic processes, in their own
nature insensible, become capable of affecting consciousness. What
follows? What is the consciousness excited? Not a consciousness of
the organic process. Of that we still remain wholly insensible. Not
simple sensation. The result uniformly produced, as long as the state
of the system is that of health, is pleasurable consciousness. The
heart sends out to the organs its vital current. Each organ,
abstracting from the stream the particles it needs, converts them
into the peculiar fluid or solid it is its office to form. The stomach,
from the arterial streamlets circulating through it, secretes gastric
juice; the liver, from the venous streamlets circulating through it,
secretes bile. When these digestive organs have duly prepared their
respective fluids, they employ them in the elaboration of the aliment.
We are not conscious of this elaboration, though it go on within us
every moment; but is consciousness not affected by the process?
Most materially. Why? Because sentient mingle with organic nerves;
because the sentient nerves are impressed by the actions of the
organic organs. And how impressed? As long as the actions of the
organic organs are sound, that is, as long as their processes are duly
performed, the impression communicated to the sentient nerves is in
its nature agreeable; is, in fact, THE PLEASURABLE
CONSCIOUSNESS WHICH CONSTITUTES THE FEELING OF HEALTH.
The state of health is nothing but the result of the due performance
of the organic organs: it follows that the feeling of health, the
feeling which is ranked by every one among the most pleasurable of
existence, is the result of the action of organs of whose direct
operations we are unconscious. But the pleasurable consciousness
thus indirectly excited is really the consequence of a special
provision, established for the express purpose of producing pleasure.
Processes, in their own nature insensible, are rendered sentient
expressly for this purpose, that, over and above the special object
they serve, they may afford enjoyment. In this case, the production
of pleasure is not only altogether gratuitous, not only communicated
for its own sake, not only rested in as an ultimate object, but it is
made to commence at the very confines of life; it is interwoven with
the thread of existence: it is secured in and by the actions that build
up and that support the very framework, the material instrument of
our being.
But if the communication of sensibility to processes in their own
nature incapable of exciting feeling, for the purpose of converting
them into sources of pleasurable consciousness, indicate an express
provision for the production of enjoyment, that provision is no less
exemplified in the point at which this superadded sensibility is made
to cease.
Some of the consequences of a direct communication of
consciousness to an organic process have been already adverted to.
Had the eye, besides transmitting rays of light to the optic nerve,
been rendered sensible of the successive passage of each ray
through its substance, the impression excited by luminous bodies,
which is indispensable to vision, the ultimate object of the
instrument, if not wholly lost, must necessarily have become
obscure, in direct proportion to the acuteness of this sensibility. The
hand of the musician could scarcely have executed its varied and
rapid movements upon his instrument, had his mind been occupied
at one and the same instant with the process of muscular
contraction in the finger, and the idea of music in the brain. Had the
communication of such a twofold consciousness been possible, in no
respect would it have been beneficial, in many it would have been
highly pernicious; and the least of the evils resulting from it would
have been, that the inferior would have interrupted the superior
faculty, and the means deteriorated the end. But in some cases the
evil would have been of a much more serious nature. Had we been
rendered sensible of the flow of the vital current through the engine
that propels it; were the distension of the delicate valves that direct
the current ever present to our view; by some inward feeling were
we reminded, minute by minute, of the progress of the aliment
through the digestive apparatus, and were the mysterious operations
of the organic nerves palpable to sight, the terror of the maniac,
who conceived that his body was composed of unannealed glass,
would be the ordinary feeling of life. Every movement would be a
matter of anxious deliberation; and the approach of every body to
our own would fill us with dismay. But adjusted as our consciousness
actually is, invariably the point at which the organic process begins is
that at which sensation ends. Had sensation been extended beyond
this point, it would have been productive of pain: at this point it
uniformly stops. Nevertheless, by the indirect connexion of sensation
with the organic processes, a vast amount of pleasure might be
created: a special apparatus is constructed for the express purpose
of establishing the communication. There is thus the twofold proof,
the positive and the negative, the evidence arising as well from what
they do, as from what they abstain from doing, that the organic
processes are, and are intended to be, sources of enjoyment.
But the production of pleasure, commencing at this the lowest point
of conscious existence, increases with the progressive advancement
of organization and function.
The appetite for food, and the voluntary actions dependent upon it,
may be considered as the first advancement beyond a process
purely organic. The function by which new matter is introduced into
the system and converted into nutriment, is partly an animal and
partly an organic operation. The animal part of it consists of the
sensations of hunger and thirst, by which we are taught when the
wants of the system require a fresh supply of aliment, together with
the voluntary actions by which the aliment is introduced into the
system. The organic part of the function consists of the changes
which the aliment undergoes after its introduction into the system,
by which it is converted into nutriment. Sensations always of a
pleasurable nature arise indirectly in the manner already explained,
from the due performance of the organic part of the function; but
pleasure is also directly produced by the performance of the animal
part of it. Wholesome food is grateful; the satisfaction of the
appetite for food is pleasurable. Food is necessary to the support of
life; but it is not indispensable to the maintenance of life that food
should be agreeable. Appetite there must be, that food may be
eaten; but the act of eating might have been secured without
connecting it with pleasure. Pleasure, however, is connected with it,
first directly, by the gratefulness of food, and secondly indirectly, by
the due digestion of the food. And the annexation of pleasure in this
twofold mode to the performance of the function of nutrition is
another case of the gratuitous bestowment of pleasure; another
instance in which pleasure is communicated for its own sake, and
rested in as an ultimate object. Pleasures of this class are sometimes
called low; they are comparatively low; but they are not the less
pleasures, because they are exceeded in value by pleasures of a
nobler nature. Man may regard them with comparative indifference,
because he is endowed with faculties which afford him gratifications
superior in kind and larger in amount; but it is no mark of wisdom to
despise and neglect even these: for they are annexed to the exercise
of a function which is the first to exalt us above a merely organic
existence; they are the first pleasures of which, considered merely
as sentient creatures, we are susceptible; they amount in the
aggregate to an immense sum; and they mark the depth in our
nature in which are laid the fountains of enjoyment.
Organs of sense, intellectual faculties, social affections, moral
powers, are superadded endowments of a successively higher order:
at the same time, they are the instruments of enjoyment of a nature
progressively more and more exquisite.
An organ of sense is an instrument composed of a peculiar
arrangement of organized matter, by which it is adapted to receive
from specific agents definite impressions. Between the agent that
produces and the organ that receives the impression, the adaptation
is such, that the result of their mutual action is, in the first place, the
production of sensation, and, in the second place, the production of
pleasure. The pleasure is as much the result as the sensation. This is
true of the eye in seeing, the ear in hearing, the hand in touching,
the organ of smell in smelling, and the tongue in tasting. Pleasure is
linked with the sense; but there might have been the sense without
the pleasure. A slight difference in the construction of the organ, or
in the intensity of the agent, would not merely have changed, it
would even have reversed the result; would have rendered the
habitual condition of the eye, the ear, the skin, not such as it now is
in health, but such as it is in the state of inflammation. But the
adjustment is such as habitually to secure that condition of the
system in which every action that excites sensation produces
pleasure as its ordinary concomitant; and the amount of enjoyment
which is thus secured to every man, and which every man without
exception actually experiences in the ordinary course of an ordinary
life, it would be beyond his power to estimate were he always
sensible of the boon; but the calculation is altogether impossible,
when, as is generally the case, he merely enjoys without ever
thinking of the provisions which enable him to do so.
But if the pleasures that arise from the ordinary operations of sense
form, in the aggregate, an incalculable sum, how great is the
accession brought to this stock by the endowments next in order in
the ascending scale, namely, the intellectual faculties!
There is one effect resulting from the operation of the intellectual
faculties on the senses that deserves particular attention. The higher
faculties elevate the subordinate in such a manner as to make them
altogether new endowments. In illustration of this, it will suffice to
notice the change wrought, as if in the very nature of sensation, the
moment it becomes combined with an intellectual operation, as
exemplified in the difference between the intellectual conception of
beauty, and the mere perception of sense. The grouping of the hills
that bound that magnificent valley which I behold at this moment
spread out before my view; the shadow of the trees at the base of
some of them, stretching its deep and varied outline up the sides of
others; the glancing light now brightening a hundred different hues
of green on the broad meadows, and now dancing on the upland
fallows; the ever-moving, ever-changing clouds; the scented air; the
song of birds; the still more touching music which the breeze
awakens in the scarcely trembling branches of those pine trees,—the
elements of which this scene is composed, the mere objects of
sense, the sun, the sky, the air, the hills, the woods, and the sounds
poured out from them, impress the senses of the animals that graze
in the midst of them; but on their senses they fall dull and without
effect, exciting no perception of their loveliness, and giving no taste
of the pleasures they are capable of affording. Nor even in the
human being, whose intellectual faculties have been uncultivated, do
they awaken either emotions or ideas; the clown sees them, hears
them, feels them no more than the herds he tends: yet in him
whose mind has been cultivated and unfolded, how numerous and
varied the impressions, how manifold the combinations, how
exquisite the pleasures produced by objects such as these!
And from the more purely intellectual operations, from memory,
comparison, analysis, combination, classification, induction, how still
nobler the pleasure! Not to speak of the happiness of him who, by
his study of natural phenomena, at length arrived at the stupendous
discovery that the earth and all the stars of the firmament move,
and that the feather falls to the ground, by the operation of one and
the same physical law; nor of the happiness of him who sent his kite
into the cloud, and brought down from its quiet bed the lightning
which he suspected was slumbering there; nor of the happiness of
him who concentrated, directed, and controlled that mighty power
which has enabled the feeble hand of man to accomplish works
greater than have been feigned of fabled giant; which has
annihilated distance; created, by economizing time; changed in the
short space in which it has been in operation the surface of the
habitable globe; and is destined to work upon it more and greater
changes than have been effected by all other causes combined; nor
of the happiness of him who devoted a longer life with equal success
to a nobler labour, that of REARING THE FABRIC OF FELICITY BY
THE HAND OF REASON AND OF LAW. The intellectual pleasures of
such men as Newton, Franklin, Watt, and Bentham, can be equalled
only by those who possess equal intellectual power, and who put
forth equal intellectual energy: to be greatly happy as they were, it
were necessary to be as highly endowed; but to be happy, it is not
necessary to be so endowed. In the ordinary intellectual operations
of ordinary men, in their ordinary occupations, there is happiness.
Every human being whose moments have passed with winged
speed, whose day has been short, whose year is gone almost as
soon as it seemed commenced, has derived from the exercise of his
intellectual faculties pleasures countless in number and inestimable
in value.
But the sympathetic pleasures, out of which grow the social, are of a
still higher order even than the intellectual. The pleasures that result
from the action of the organic organs, from the exercise of the
several senses, and from the operation of the intellectual faculties,
like the sensations in which they arise, belong exclusively to the
individual being that experiences them, and cannot be
communicated to another. Similar sensations and pleasures may be
felt by beings similarly constituted; but the actual sensations and
pleasures afforded by the exercise of a person's own organs and
faculties are no more capable of becoming another's than his
existence. These, then, are strictly the selfish pleasures; and the
provision that has been made for securing them has been shown.
But there are pleasures of another class, pleasures having no
relation whatever to a person's own sensation or happiness;
pleasures springing from the perception of the enjoyment of others.
The sight of pleasure not its own affects the human heart, provided
its state of feeling be natural and sound, just as it would be affected
were it its own. Not more real is the pleasure arising from the
gratification of appetite, the exercise of sense, and the operation of
intellect, than that arising from the consciousness that another
sentient being is happy. Pleasures of this class are called
sympathetic, in contradistinction to those of the former class, which
are termed selfish.
There are then two principles in continual operation in the human
being, the selfish and the sympathetic. The selfish is productive of
pleasure of a certain kind; the sympathetic is productive of pleasure
of another kind. The selfish is primary and essential; the
sympathetic, arising out of the selfish, is superadded to it. And so
precisely what the animal life is to the organic, the sympathetic
principle is to the selfish; and just what the organic life gains by its
union with the animal, the mental constitution gains by the addition
of the sympathetic to the selfish affection. The analogy between the
combination in both cases is in every respect complete. As the
organic life produces and sustains the animal, so the sympathetic
principle is produced and sustained by the selfish. As the organic life
is conservative of the entire organization of the body, so the selfish
principle is conservative of the entire being. As the animal life is
superadded to the organic, extending, exalting, and perfecting it, so
the sympathetic principle is superadded to the selfish, equally
extending, exalting, and perfecting it. The animal life is nobler than
the organic, whence the organic is subservient to the animal; but
there is not only no opposition, hostility, or antagonism between
them, but the strictest possible connexion, dependence, and
subservience. The sympathetic principle is nobler than the selfish,
whence the selfish is subservient to the sympathetic; but there is not
only no opposition, hostility, or antagonism between them, but the
strictest possible connexion, dependence, and subservience.
Whatever is conducive to the perfection of the organic, is equally
conducive to the perfection of the animal life; and whatever is
conducive to the attainment of the true end of the selfish is equally
conducive to the attainment of the true end of the sympathetic
principle. The perfection of the animal life cannot be promoted at
the expense of the organic, nor that of the organic at the expense of
the animal; neither can the ultimate end of the selfish principle be
secured by the sacrifice of the sympathetic, nor that of the
sympathetic by the sacrifice of the selfish. Any attempt to exalt the
animal life beyond what is compatible with the healthy state of the
organic, instead of accomplishing that end, only produces bodily
disease. Any attempt to extend the selfish principle beyond what is
compatible with the perfection of the sympathetic, or the
sympathetic beyond what is compatible with the perfection of the
selfish, instead of accomplishing the end in view, only produces
mental disease. Opposing and jarring actions, antagonizing and
mutually destructive powers, are combined in no other work of
nature; and it would be wonderful indeed were the only instance of
it found in man, the noblest of her works, and in the mind of man,
the noblest part of her noblest work.
No one supposes that there is any such inharmonious combination in
the organization of his physical frame, and the notion that it exists in
his mental constitution, as it is founded in the grossest ignorance, so
it is productive of incalculable mischief. In both, indeed, are manifest
two great powers, each distinct; each having its own peculiar
operation; and the one being subservient to the other, but both
conducing alike to one common end. By the addition of the
apparatus of the animal to that of the organic life, a nobler structure
is built up than could have been framed by the organic alone: by the
addition of the sympathetic to the selfish part of the mental
constitution, a happier being is formed than could have been
produced by the selfish alone. And as the organic might have existed
without the animal life, but by the addition of the animal a new and
superior being is formed, so might the selfish part of the mental
constitution, and the pleasures that flow from it, have existed alone;
but by the addition of the sympathetic, a sum is added to
enjoyment, of the amount of which some conception may be formed
by considering what human life would be, with every selfish appetite
and faculty gratified in the fullest conceivable degree, but without
any admixture whatever of sympathetic or social pleasure. Selfish
enjoyment is not common. If any one set himself to examine what
at first view might seem a purely selfish pleasure, he will soon be
sensible that, of the elements composing any given state of mind to
which he would be willing to affix the term pleasurable, a vast
preponderance consists of sympathetic associations. The more
accurately he examine, and the farther he carry his analysis, the
stronger will become his conviction, that a purely selfish enjoyment,
that is, a truly pleasurable state of mind, in no degree, mediately or
immediately, connected with the pleasurable state of another mind,
is exceedingly rare.
But if the constitution of human nature and the structure of human
society alike render it difficult for the human heart to be affected
with a pleasure in no degree derived from—absolutely and totally
unconnected with sympathetic association, of that complex pleasure
which arises out of social intercourse, partly selfish and partly
sympathetic, how far sweeter the sympathetic than the selfish part;
and as the sympathetic preponderates over the selfish, how vast the
increase of the pleasure! And when matured, exalted into affection—
affection, that holy emotion which exerts a transforming influence
over the selfish part of human nature, turning it into the
sympathetic; affection, which renders the happiness of the beloved
object inexpressibly dearer to the heart than its own; affection,
among the benignant feelings of which as there is none sweeter so
there is none stronger than that of self-devotion, nay, sometimes
even of self-sacrifice; affection, which is sympathy pure,
concentrated, intense—Oh how beautiful is the constitution of this
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like