100% found this document useful (13 votes)
35 views

Get Beginning Web Programming with HTML XHTML and CSS Jon Duckett free all chapters

Beginning

Uploaded by

lateympr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (13 votes)
35 views

Get Beginning Web Programming with HTML XHTML and CSS Jon Duckett free all chapters

Beginning

Uploaded by

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

Download the full version of the ebook at ebookname.

com

Beginning Web Programming with HTML XHTML and CSS


Jon Duckett

https://ebookname.com/product/beginning-web-programming-
with-html-xhtml-and-css-jon-duckett/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

HTML Your visual blueprint for designing effective Web


pages with HTML CSS and XHTML 1st Edition Paul Whitehead

https://ebookname.com/product/html-your-visual-blueprint-for-
designing-effective-web-pages-with-html-css-and-xhtml-1st-edition-
paul-whitehead/
ebookname.com

HTML XHTML CSS for Dummies 7th Edition Ed Tittel

https://ebookname.com/product/html-xhtml-css-for-dummies-7th-edition-
ed-tittel/

ebookname.com

HTML XHTML and CSS comprehensive 6th ed Edition Gary B


Shelly

https://ebookname.com/product/html-xhtml-and-css-comprehensive-6th-ed-
edition-gary-b-shelly/

ebookname.com

Managing Archives Foundations Principles and Practice 1st


Edition Caroline Williams (Auth.)

https://ebookname.com/product/managing-archives-foundations-
principles-and-practice-1st-edition-caroline-williams-auth/

ebookname.com
Automotive lubricants reference book 2nd ed Edition Caines

https://ebookname.com/product/automotive-lubricants-reference-
book-2nd-ed-edition-caines/

ebookname.com

Gilbert Law Summary on Criminal Procedure 19th ed. Edition


Paul Marcus

https://ebookname.com/product/gilbert-law-summary-on-criminal-
procedure-19th-ed-edition-paul-marcus/

ebookname.com

The Christians as the Romans Saw Them Second Edition


Robert Lewis Wilken

https://ebookname.com/product/the-christians-as-the-romans-saw-them-
second-edition-robert-lewis-wilken/

ebookname.com

IT Made E Z Patrick H. Bowman

https://ebookname.com/product/it-made-e-z-patrick-h-bowman/

ebookname.com

Legislation Technology and Practice of Mine Land


Reclamation Zhenqi Hu

https://ebookname.com/product/legislation-technology-and-practice-of-
mine-land-reclamation-zhenqi-hu/

ebookname.com
Conversation Strategies 3rd Edition Kehe

https://ebookname.com/product/conversation-strategies-3rd-edition-
kehe/

ebookname.com
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page v

Beginning
Web Programming with
HTML, XHTML, and CSS

Second Edition

Jon Duckett
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page iv
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page i

Beginning Web Programming with


HTML, XHTML, and CSS
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Chapter 1: Creating Structured Documents . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2: Links and Navigation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 3: Images and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Chapter 4: Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Chapter 5: Forms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Chapter 6: Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Chapter 7: Cascading Style Sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Chapter 8: More Cascading Style Sheets . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Chapter 9: Page Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Chapter 10: Design Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
Chapter 11: Learning JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Chapter 12: Working with JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Chapter 13: Putting Your Site on the Web . . . . . . . . . . . . . . . . . . . . . . . . . 501
Appendix A: Answers to Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Appendix B: XHTML Element Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Appendix C: CSS Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Appendix D: Color Names and Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Appendix E: Character Encodings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
Appendix F: Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Appendix G: Language Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Appendix H: MIME Media Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
Appendix I: Deprecated and Browser-Specific Markup. . . . . . . . . . . . . . . . . 681
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page ii
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page iii

Beginning
Web Programming with
HTML, XHTML, and CSS

Second Edition
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page iv
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page v

Beginning
Web Programming with
HTML, XHTML, and CSS

Second Edition

Jon Duckett
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page vi

Beginning Web Programming


with HTML, XHTML, and CSS, Second Edition
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
ISBN: 978-0-470-25931-3
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted
under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission
of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance
Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher
for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd.,
Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go
/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or war-
ranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all
warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be
created or extended by sales or promotional materials. The advice and strategies contained herein may not
be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in
rendering legal, accounting, or other professional services. If professional assistance is required, the services
of a competent professional person should be sought. Neither the publisher nor the author shall be liable for
damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation
and/or a potential source of further information does not mean that the author or the publisher endorses the
information the organization or Website may provide or recommendations it may make. Further, readers
should be aware that Internet Websites listed in this work may have changed or disappeared between when
this work was written and when it is read.
For general information on our other products and services or to obtain technical support, please contact
our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax
(317) 572-4002.
Library of Congress Cataloging-in-Publication Data is available from the publisher.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related
trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the
United States and other countries, and may not be used without written permission. All other trademarks
are the property of their respective owners. Wiley Publishing, Inc. is not associated with any product or
vendor mentioned in this book.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic books.
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page vii

About the Author


Jon Duckett published his first web site in 1996 while studying for a BSc (Hons) in Psychology at Brunel
University, London. Since then, he has helped create a wide variety of web sites for companies of all
sizes. He has also co-written more than ten programming-related books on topics from ASP to XML (via
many other letters of the alphabet), covering diverse aspects of web programming including design,
architecture, and coding.

About the Technical Editor


Ben Schupak holds a master’s degree in computer science and has more than nine years of professional
programming experience for large corporations and U.S. federal departments. He lives in the New York
metro area and enjoys traveling.
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page viii
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page ix

Credits
Acquisitions Editor Vice President and Executive Group Publisher
Jennifer Watson Richard Swadley

Development Editor Vice President and Executive Publisher


William Bridges Joseph B. Wikert

Technical Editor Project Coordinator, Cover


Benjamin Schupak Lynsey Stanford

Production Editor Compositor


Christine O’Connor Simmy Cover, Happenstance Type-O-Rama

Copy Editor Proofreader


Nancy Rapoport Christopher Jones

Editorial Manager Indexer


Mary Beth Wakefield Johnna VanHoose Dinse

Production Manager
Tim Tate
59313ffirs.qxd:WroxPro 3/22/08 2:30 PM Page x
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xi

Contents

Introduction xxiii

Chapter 1: Creating Structured Documents 1


A Web of Structured Documents 1
Introducing XHTML 2
Core Elements and Attributes 9
The <html> Element 9
The <head> Element 10
The <title> Element 11
The <body> Element 11
Attribute Groups 12
Core Attributes 12
Internationalization 14
UI Events 15
Basic Text Formatting 16
White Space and Flow 17
Creating Headings Using hn Elements 18
Creating Paragraphs Using the <p> Element 21
Creating Line Breaks Using the <br /> Element 21
Creating Preformatted Text Using the <pre> Element 22
Presentational Elements 26
The <b> Element 26
The <i> Element 26
The <u> Element (deprecated) 27
The <s> and <strike> Elements (deprecated) 27
The <tt> Element 27
The <sup> Element 28
The <sub> Element 28
The <big> Element 28
The <small> Element 28
The <hr /> Element 28
Phrase Elements 29
The <em> Element Adds Emphasis 30
The <strong> Element Adds Strong Emphasis 30
The <abbr> Element Is for Abbreviations 31
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xii

Contents
The <acronym> Element Is for Acronym Use 31
The <dfn> Element Is for Special Terms 32
The <blockquote> Element Is for Quoting Text 32
The <q> Element Is for Short Quotations 33
The <cite> Element Is for Citations 33
The <code> Element Is for Code 34
The <kbd> Element Is for Text Typed on a Keyboard 34
The <var> Element Is for Programming Variables 35
The <samp> Element Is for a Program Output 35
The <address> Element Is for Addresses 36
Lists 36
Using the <ul> Element to Create Unordered Lists 36
Ordered Lists 37
Definition Lists 39
Nesting Lists 40
How It Works 43
Editing Text 45
Using <ins> to Indicate New Additions to Text 46
Using <del> to Indicate Deleted Text 46
Using Character Entities for Special Characters 47
Comments 47
The <font> Element (deprecated) 48
Understanding Block and Inline Elements 48
Grouping Elements with <div> and <span> 49
Summary 50
Exercises 51

Chapter 2: Links and Navigation 53


Basic Links 54
Linking to Other Documents 54
Linking to E-mail Addresses 56
Understanding Directories and Directory Structures 57
What Are You Linking To? 58
What a URL Is Made Up Of 59
Absolute and Relative URLs 61
The <base> Element 64
Creating Links with the <a> Element 65
Creating a Source Anchor with the href Attribute 65
Creating a Destination Anchor Using the name and id Attributes
(linking to a specific part of a page) 66

xii
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xiii

Contents
Advanced E-mail Links 74
Summary 75
Exercises 76

Chapter 3: Images and Objects 77


Adding Images to Your Site 77
Types of Image Formats 78
Bitmap Images 78
Vector Images 85
Adding Images Using the <img> Element 86
Adding Other Objects with the <object> Element 93
The <object> Element’s Attributes 94
The <param> Element 97
Adding a Flash Movie To A Page 98
Using Images as Links 99
Image Maps 100
Server-Side Image Maps 101
Client-Side Image Maps 102
Summary 105
Exercises 106

Chapter 4: Tables 109


Introducing Tables 109
Basic Table Elements and Attributes 112
The <table> Element Creates a Table 113
The <tr> Element Contains Table Rows 117
The <td> and <th> Elements Represent Table Cells 119
Advanced Tables 125
Splitting Up Tables Using a Head, Body, and Foot 125
Adding a <caption> to a Table 128
Spanning Columns Using the colspan Attribute 128
Spanning Rows Using the rowspan Attribute 129
Grouping Columns Using the <colgroup> Element 130
Columns Sharing Styles Using the <col> Element 132
Accessibility Issues with Tables 132
How Tables Linearize 132
Linearization of Tables Used for Layout 133
Linearization of Tables Used for Data 135
Summary 136
Exercises 136

xiii
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xiv

Contents
Chapter 5: Forms 139
Introducing Forms 140
Creating a Form with the <form> Element 141
The action Attribute 142
The method Attribute 142
The id Attribute 142
The name Attribute (deprecated) 142
The onsubmit Attribute 143
The onreset Attribute 143
The enctype Attribute 144
The accept-charset Attribute 144
The accept Attribute 144
The target Attribute 145
White Space and the <form> Element 145
Form Controls 145
Text Inputs 145
Buttons 150
Checkboxes 154
Radio Buttons 156
Select Boxes 158
File Select Boxes 164
Hidden Controls 165
Object Controls 166
Creating Labels for Controls and the <label> Element 169
Structuring Your Forms with <fieldset> and <legend> Elements 171
Focus 173
Tabbing Order 173
Access Keys 175
Disabled and Read-Only Controls 176
Sending Form Data to the Server 178
HTTP get 178
HTTP post 179
Summary 183
Exercises 183

Chapter 6: Frames 185


Introducing the Frameset 185
When to Use Frames 188
The <frameset> Element 189
The cols Attribute 189
The rows Attribute 191

xiv
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xv

Contents
Browser-Specific Extensions to the <frameset> Element 192
The <frame> Element 194
The src Attribute 195
The name Attribute 195
The frameborder Attribute 195
The marginwidth and marginheight Attributes 196
The noresize Attribute 196
The scrolling Attribute 196
The longdesc Attribute 197
The <noframes> Element 197
Creating Links Between Frames 198
Setting a Default Target Frame Using the <base> Element 200
Nested Framesets 200
Floating or Inline Frames with <iframe> 204
The <iframe> Element 206
Summary 209
Exercises 209

Chapter 7: Cascading Style Sheets 211


Introducing CSS 212
A Basic Example 213
Inheritance 216
Where You Can Add CSS Rules 217
The <link> Element 218
The <style> Element 220
Advantages of External CSS Style Sheets 220
CSS Properties 221
Controlling Fonts 223
The font-family Property 224
The font-size Property 226
The font-weight Property 227
The font-style Property 228
The font-variant Property 229
The font-stretch Property 230
The font-size-adjust Property 230
Text Formatting 230
The color Property 231
The text-align Property 231
The vertical-align Property 232
The text-decoration Property 234
The text-indent Property 234
The text-shadow Property 235

xv
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xvi

Contents
The text-transform Property 235
The letter-spacing Property 236
The word-spacing Property 237
The white-space Property 237
The direction Property 238
The unicode-bidi Property 239
Text Pseudo-Classes 239
The first-letter Pseudo-Class 239
The first-line Pseudo-Class 240
Selectors 243
Universal Selector 243
The Type Selector 243
The Class Selector 244
The ID Selector 244
The Child Selector 244
The Descendent Selector 245
The Adjacent Sibling Selector 245
Using Child and Adjacent Sibling Selectors to Reduce Dependence
on Classes in Markup 245
Attribute Selectors 247
Lengths 249
Absolute Units 249
Relative Units 249
Percentages 251
Introducing the Box Model 251
An Example Illustrating the Box Model 252
The Border Properties 255
The padding Property 258
The margin Property 259
Dimensions 260
Summary 270
Exercises 270

Chapter 8: More Cascading Style Sheets 273


Links 274
Backgrounds 275
The background-color Property 276
The background-image Property 277
The background-repeat Property 278
The background-position Property (for fixing position of backgrounds) 281
The background-attachment Property (for watermarks) 282
The background Property (the well-supported shorthand) 283

xvi
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xvii

Contents
Lists 283
The list-style-type Property 284
The list-style-position Property 285
The list-style-image Property 286
The list-style Property (the shorthand) 286
The marker-offset Property 287
Tables 287
Table-Specific Properties 289
The border-collapse Property 289
The border-spacing Property 291
The caption-side Property 292
The empty-cells Property 292
The table-layout Property 294
Outlines 294
The outline-width Property 295
The outline-style Property 295
The outline-color Property 295
The outline Property (the shorthand) 296
The :focus and :active Pseudo-Classes 296
Generated Content 297
The :before and :after Pseudo-Elements 297
The content Property 298
Miscellaneous Properties 301
The cursor Property 301
The display Property 302
The visibility Property 302
Additional Rules 304
The @import Rule: Modularized Style Sheets 304
The @charset Rule 305
The !important Rule 305
Positioning with CSS 305
Normal Flow 306
The position Property 306
Box Offset Properties 307
Relative Positioning 307
Absolute Positioning 309
Fixed Positioning 310
The z-index Property 311
Floating Using the float Property 312
The clear Property 314
Summary 320
Exercises 321

xvii
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xviii

Contents
Chapter 9: Page Layout 323
Understanding the Site 323
Understanding a Site’s Aims 324
Whom You Expect to Visit 325
New Content 326
Defining Your Site’s Content 326
Grouping and Categorization 327
Creating a Site Map 328
Identifying Key Elements for Every Page 329
Page Size (and Screen Resolution) 330
Fixed-Width vs. Liquid Designs 331
Designing Pages 337
Sketching the Placement of Elements 337
Introducing the Style 339
Navigation 342
Home Pages 345
Content Pages 345
Structuring Pages 346
Single-Column Layouts 348
Two-Column Layouts 350
Three-Column Layouts 353
Sacrificial Columns 354
Advanced Layout Using CSS 356
Creating a Layout Using Nested Tables 356
Summary 359
Exercises 359

Chapter 10: Design Issues 361


Text 362
White Space Helps Make More Attractive Pages 362
Carefully Aligned Text Is More Readable 365
Adjusting Line Height Makes Text More Readable 365
Wide Columns of Text Are Harder to Read 366
Background Images Can Make Text Hard to Read 366
Choose Fonts Carefully 367
Fixed-Size Fonts Are Affected by Screen Resolution 369
Navigation 369
Menus 369
Links 374
Site Search Features 375

xviii
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xix

Contents
Shading Multiple Rows of a Table 378
Forms 380
Before Designing the Form 380
Designing the Form 382
Summary 401
Exercises 401

Chapter 11: Learning JavaScript 403


What Is Programming About? 404
How to Add a Script to Your Pages 406
Comments in JavaScript 408
The <noscript> Element 408
The Document Object Model 410
Introducing the Document Object Model 410
Objects, Methods, and Properties 412
The Forms Collection 415
Form Elements 416
Images Collection 419
Different Types of Objects 422
Starting to Program with JavaScript 422
Variables 423
Assigning a Value to a Variable 424
Lifetime of a Variable 424
Operators 424
Arithmetic Operators 425
Assignment Operators 425
Comparison Operators 426
Logical or Boolean Operators 427
String Operator 427
Functions 427
How to Define a Function 428
How to Call a Function 428
The Return Statement 429
Conditional Statements 429
if Statements 429
if . . . else Statements 430
A switch Statement 431
Conditional (or Ternary) Operator 432
Looping 432
while 433
do . . . while 434

xix
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xx

Contents
for 434
Infinite Loops and the break Statement 435
Events 435
Built-in Objects 437
String 437
Date 441
Math 444
Array 446
Window 447
Writing JavaScript 449
A Word About Data Types 450
Keywords 451
Summary 451
Exercises 452

Chapter 12: Working with JavaScript 453


Practical Tips for Writing Scripts 453
Has Someone Already Written This Script? 454
Reusable Functions 454
Using External JavaScript Files 455
Place Scripts in a Scripts Folder 455
Form Validation 456
When to Validate 456
How to Validate 456
Form Enhancements 470
Focus on First Form Item 470
Auto-Tabbing Between Fields 471
Disabling a Text Input 472
Case Conversion 474
Trimming Spaces from Beginning and End of Fields 474
Selecting All the Content of a Text Area 475
Check and Uncheck All Checkboxes 476
Image Rollovers 482
Random Script Generator 485
Pop-Up Windows 486
JavaScript Libraries 487
Animated Effects using Scriptaculous 488
Drag-and-Drop Sortable Lists Using Scriptaculous 490
Sortable Tables with MochiKit 492
Creating Calendars with YUI 494
Auto-Completing Text Inputs with YUI 495

xx
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xxi

Contents
When Not to Use JavaScript 496
Drop-Down Navigation Menus 497
Hiding Your E-mail Address 497
Quick Jump Select Boxes 497
Anything the User Requires from Your Site 497
Summary 498
Exercises 498

Chapter 13: Putting Your Site on the Web 501


Meta Tags 502
name and content Attributes 503
http-equiv and content 505
The scheme Attribute 508
Testing Your Site 508
The Importance of Directory Structure and Relative URLs 509
Validating HTML, XHTML, and CSS 509
Link Checking 513
Checking Different Screen Resolutions and Color Depths 514
Accessibility Checkers 514
Development Server or Live Server 515
Checking in Different Versions of Browsers 515
Pilot Testing 516
Proofreading 517
Taking the Leap to Live 517
Getting a Domain Name 517
Hosting 518
Search Engine Strategies 522
Other Web Marketing Possibilities 525
Statistical Analysis 526
Version Control 527
What Next? 529
Blogs 529
Discussion Boards or Forums 530
Adding a Search Utility 530
Introducing Other Technologies 531
Server-Side Web Programming: ASP.NET, and PHP 531
Choosing a Server-Side Language 532
Content Management 532
Flash 535
Learning Graphics Packages 536
Summary 537

xxi
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xxii

Contents
Appendix A: Answers to Exercises 539

Appendix B: XHTML Element Reference 563

Appendix C: CSS Properties 607

Appendix D: Color Names and Values 637

Appendix E: Character Encodings 645

Appendix F: Special Characters 649

Appendix G: Language Codes 665

Appendix H: MIME Media Types 669

Appendix I: Deprecated and Browser-Specific Markup 681

Index 715

xxii
59313flast.qxd:WroxPro 3/22/08 2:31 PM Page xxiii

Introduction

There are a lot of books about designing and building web pages, so thank you for picking up this one.
Why do I think it is different? Well, the Web has been around for over a decade now, and during its life
many technologies have been introduced to help you create web pages, some of which have lasted, others
of which have disappeared. Many books that teach you to write web pages are revisions of earlier versions
of the same book and therefore still take the same approach as the previous edition did. The purpose of
this book, however, is to teach you how to create pages for the Web as it is today and will be for the next
few years. Then, once you have worked through this book, it should continue to serve as a helpful refer-
ence text you can keep nearby and dip into when you need to.

At one time, you needed to learn only one language to write web pages: HTML. As the Web has advanced,
however, so have the technologies you need to learn in order to create effective and attractive web pages.
As the title of this book suggests, you will be learning a few different languages:

❑ HTML and XHTML: HTML and XHTML are needed to explain the structure of any web pages.
They’re used to indicate what text should be considered a heading, where paragraphs start and
end, and what images should appear in the document, and to specify links between different
pages. As you might be relieved to hear, you shouldn’t think of HTML and XHTML as two sep-
arate languages. Rather, you can consider XHTML as more like the latest version of HTML.
❑ CSS: CSS is used to control how a document should appear. For example, you can use it to spec-
ify that a typeface should be a large, bold, Arial typeface or that the background of a page should
be a light green. It can also be used to control where different items appear on a page. For example,
you can use CSS to present text in two columns on the same page.
❑ JavaScript: You learn a little bit of JavaScript to add interactivity to the web pages you create, and
to work with the browser displaying the web page.

Despite the fact that you are looking at several languages, not just HTML, you can consider it a very good
time to be coming to the Web because many of the technologies used to create web pages have matured,
and favored methods, or “best practices,” for creating web sites have been emerging. It is these that you
will be learning.

About the Book


As you have already seen, you’ll be learning how to control the structure of a web page with HTML and
XHTML, how to style it with CSS, and how to add interactivity with JavaScript. Just learning about the
latest technologies, however, is not enough to ensure that you can write great web pages. As these tech-
nologies to write web pages have improved, so too have browsers (the programs and devices used to access
the Web). Browsers have reflected — and on occasion even informed — the way the languages used to
create web pages have developed. The problem, as you can probably imagine, is that not everyone has the
latest software installed on his or her computer, and as a result you will not only want to be able to write
Another Random Scribd Document
with Unrelated Content
THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the


United States and most other parts of the world at no cost
and with almost no restrictions whatsoever. You may copy
it, give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.

You might also like