HTML & XHTML: The Complete Reference

HTML & XHTML: The Complete Reference

by Thomas Powell

Paperback(Fourth Edition)


Product Details

ISBN-13: 9780072229424
Publisher: McGraw-Hill Companies, The
Publication date: 08/19/2003
Series: Osborne Complete Reference Series
Edition description: Fourth Edition
Pages: 956
Product dimensions: 7.30(w) x 9.00(h) x 1.86(d)

About the Author

About the Author

Thomas A. Powell (San Diego, CA) is President of PINT, Inc., a San Diego based Web development and design firm that services major corporations including Sanyo, Kyocera, Viewsonic, Toshiba and many others. Thomas is a long-standing Web educator and developed the Web Publishing Certificate program for UCSD Extension and is an instructor for the Computer Science Department of UCSD as well. He is the author of Web Design: The Complete Reference (McGraw-Hill/Osborne 2002), JavaScript: The Complete Reference (McGraw-Hill/Osborne 2001), and Web Site Engineering (Prentice Hall 1999). He has written numerous articles on Web design and development technologies both for online and print publications including Network World. His firm PINT is a member of the World Wide Web Consortium (W3C) and actively tracks Web standards development as it relates to Web design.

Read an Excerpt

Chapter 1: Introduction to HTML and XHTML

...Myths about HTML and XHTML

HTML is a powerful technology, but many misconceptions exist about it. Understanding what HTML is not will certainly help page developers avoid common mistakes.

Myth: HTML Is a WYSIWYG Design Language

HTML isn't a specific, screen- or printer-precise formatting language like PostScript. Many people struggle with HTML on a daily basis, trying to create perfect layouts by using HTML elements inappropriately or by using images to make up for HTML's lack of screen and font-handling features. Other technologies, such as Cascading Style Sheets (CSS), are far better than HTML for handling presentation issues; their use returns HTML back to its structural roots.

Myth: HTML Is a Programming Language

Many people think that making HTML pages is similar to programming. However, HTML is unlike programming in that it does not specify logic. It specifies the structure and often the layout of a document. With the introduction of scripting languages such as JavaScript, however, the concept of dynamic HTML (DHTML) is becoming more and more popular and is used to create highly interactive Web pages. Simply put, DHTML provides scripting languages with the capability to modify HTML elements and their content before, and possibly after, the page has been loaded.

DHTML blurs the lines between HTML as a layout language and HTML as a programming environment. However, the line should be distinct, because HTML is not a programming language. Heavily intermixing code with HTML markup in the ad-hoc manner that many DHTML authors do is far worse than trying to use HTML as a WYSIWYG markuplanguage. Programming logic can be cleanly separated in HTML in the form of script code, as discussed in Chapter 13. Unfortunately, if this separation isn't heeded, the page maintenance nightmare that results from tightly binding programming logic to content will dwarf the problems caused by misuse of HTML code for presentation purposes.

Myth: HTML Is Complete

HTML is not finished. The language does not provide all the facilities it should, even as a logical markup language. However, work is presently focused on implementing the current HTML standards under a new language, called eXtensible Markup Language (XML). Future versions of HTML will almost certainly be defined as a subset of XML. Theoretically, this is a wise decision, but the ubiquitous nature of HTML and its huge installed base suggest that considering how to extend HTML or fill in its small gaps is an incredibly important task. The W3C's current HTML Activity Statement can be found on its Web site (

Myth: HTML Is Completely Standardized

Although the WK defines the HTML specification, in practical terms browser vendors and users often define their own de facto standards, or decide what aspects of the standards they support. While this might sound like heresy, it is true. Up until recently, when a new browser supporting a new feature was released, many companies and individuals would rush to use it, regardless of whether the feature was included in the W3C HTML standard. Today a major goal of browser vendors is to bring standard conformance to the Web, which cannot happen too soon. However, for the time being designers have to respect the past forms of markup, problems and all.

Myth: Traditional HTML Is Going Away

HTML is the foundation of the Web; with literally billions of pages in existence, not every document is going to be upgraded anytime soon. The "legacy" Web will continue for years, and HTML will always be lurking around underneath even the most advanced Web page years from now.

Myth: XHTML Will Take the Public Web By Storm

Wishful thinking, but having taught HTML for years and noticing how both editors and people build Web pages, it is very unlikely that XHTML will be the norm before the end of the year 2000, or probably even for years well beyond that. The problem is that if browsers suddenly enforced XHTML rules, few of today's existing Web documents would render at all; remember that although HTML has had rules for years, people have not really bothered much of the time to follow them. Many people learn HTML simply through imitation by viewing the source of existing pages, which are not always written correctly, and going from there. Like learning a spoken language, it is the occasional, loosely enforced rules that have allowed many document authors to quickly get involved with HTML. Like the English language, HTML is well understood and used in lots of places, but not often used perfectly. Rigor will come to the Web, but don't expect it to happen all at once.

Myth: Hand-Coding of HTML Will Continue for Decades

Although some will continue to craft pages like mechanical typesetting, as the Web editors improve and standards take root, the requirement to hand-tweak HTML layouts will diminish. Hopefully, designers will realize that knowledge of the "invisible pixel" trick is not a bankable resume bullet and instead focus on development of their talents along with a firm understanding of HTML markup.

Myth: HTML Is All You Need to Know to Create Good Web Pages Whereas HTML is the basis for Web pages, you need to know a lot more than HTML to build useful Web pages (unless the page is very simple). Document design, graphic design, and even programming often are necessary to create sophisticated Web pages. HTML serves as the foundation environment for all of these tasks, and a complete understanding of HTML technology can only aid document authors. A brief discussion of some of the other aspects of Web design is presented in the next chapter.


HTML is the markup language for building Web pages and traditionally has combined physical and logical structuring ideas. Elements-in the form of tags such as <b> and </b>-are embedded within text documents to indicate to browsers how to render pages. The rules for HTML are fairly simple. Unfortunately, these rules have not been enforced by browsers in the past. Because of this looseness, there has been a great deal of misunderstanding about the purpose of HTML, and a good portion of the documents on the Web do not conform to any particular "official" specification of HTML. The introduction of XHTML attempts to return HTML to its roots as a structural language, leaving presentational duties to other technologies such as Cascading Style Sheets. The newest version of HTML also attempts to introduce the required rigor and enforcement of syntax that will make HTML a solid foundation on which to build tomorrow's Web applications. While heavy use of strict XHTML has yet to occur on the Web, document authors following the rules presented, even using classic HTML, should be well suited to make the transition to perfectly formed documents. Before plunging in to the core elements of HTML, we'll take a look at Web development practices and project planning useful to aspiring HTML document authors.

The preceding is only a brief introduction to some of the "rules" that HTML documents tend to follow. Unfortunately, the benefit of following the rules isn't always apparent to new Web developers, because most browsers don't strictly enforce the standards. For example, although the nesting rule agrees with the formal definition of HTML, most browsers have no problem with crossed tags, or even with tags being used totally improperly. The reason for the browsers' laxity in enforcement is actually very logical: A browser would display nonstop error messages if it displayed a message every time that it encountered a slightly miscoded Web page! Nevertheless, don't use the browsers' laxity in enforcing HTML's "rules" as an excuse to misuse HTML or sloppily code a page. Standards impose specific structural requirements on documents, and as the Web becomes increasingly more complicated and technologies such as the eXtensible Markup Language (XML) are adopted, following the standards will become much more important.

Unfortunately, many document authors are unfamiliar with standards. Thus, they might not pay attention to the structure because they don't understand the philosophy of HTML; or, they might think of HTML as a physical page-description language, such as PostScript, rather than a logical, structure-oriented markup language. Browsers don't discourage this view, and might even encourage the physical view...

Table of Contents

Part IIntroduction
1Introduction to HTML and XHTML3
First Look at HTML3
Document Types10
The [left angle bracket]html[right angle bracket] Tag14
The [left angle bracket]head[right angle bracket] Tag14
The [left angle bracket]body[right angle bracket] Tag17
Elements and Characters17
The Rules of HTML18
XHTML: The Rules Enforced22
Major Themes23
2Web Development Overview27
The Need for Careful Web Development27
Basic Web Process Model28
Approaching a Web Site Project29
The Site Plan33
Design Phase Dissected36
Beta Site Implementation49
Release and Beyond51
Welcome to the Real World51
Part IICore HTML and XHTML
3Core Elements55
Document Structure Redux55
Core HTML Attributes56
Paragraphs and Breaks61
Divisions and Centering64
Preformatted Text67
Horizontal Rules77
Other Block-Level Elements78
Text-Level Elements79
Inserted and Deleted Text85
Character Entities86
4Links and Addressing91
Linking Basics91
What Are URLs?94
Linking in HTML109
Anchor Attributes112
Images and Anchors117
Image Maps119
Semantic Linking with the link Element128
Beyond Location133
Part IIIPresentation and Layout
Image Preliminaries141
HTML Image Basics152
Images as Buttons163
Image Maps164
Advanced Image Considerations165
Tips on Image Use167
6Text, Colors, and Backgrounds171
HTML Approach to Visual Design171
Colors in HTML189
Color Attributes for body190
Background Images192
Controlling Page Margins195
7Tables and Layout197
Introduction to Tables197
Tables for Layout202
Applied Layout Using Tables210
Advanced Data Tables223
Databinding: Tables Generated from a Data Source226
Frame Layouts239
Floating Frames243
Frame Problems245
PDF Format265
Style Sheet Basics269
Adding Style to a Document271
CSS and HTML Elements277
Document Structure and Inheritance284
Complete Style Sheet Example288
CSS1 Properties289
Font Properties292
Text Properties297
List Properties303
Color and Background Properties307
Box Properties311
Display Properties324
The Rise of CSS2327
CSS Properties332
CSS3: Someday?358
Microsoft-Specific Style Sheet Properties Sampler358
Part IVInteractivity
How Are Forms Used?365
Form Preliminaries366
The [left angle bracket]form[right angle bracket] Tag366
The name and id Attributes371
Form Field Elements372
Other Form Elements389
Form Accessibility Enhancements393
Browser-Specific Form Accessibility Improvements395
Miscellaneous Form Field Attributes396
Form Presentation397
Forms and Scripting402
The Rise of XForms?402
13Introduction to Server-Side Programming405
Overview of Client/Server Programming on the Web405
Server-Side Programming407
Common Gateway Interface (CGI)408
Server Modules: Apache Modules, ISAPI, and Others419
Server-Side Scripting419
Active Server Pages (ASP) and ASP.NET428
Choosing a Server-Side Scripting Language431
14JavaScript and DHTML433
Including Scripts in an XHTML Document436
JavaScript Language Overview446
JavaScript Object Models448
Markup Elements and Scripting Access452
Dynamic HTML455
The Standard DOM456
Scripting and CSS458
Cross-Browser JavaScript459
Common Scripts462
15Plug-ins, ActiveX Controls, and Java Applets473
Scripting, Programming, and Objects473
ActiveX Controls480
Java Applets486
Cross-Platform [left angle bracket]object[right angle bracket] Syntax Today and Tomorrow493
Part VSite Delivery and Management
16HTTP and Site Delivery499
The Importance of Delivery499
How to Deliver Web Sites500
Outsourcing Web Hosting501
Web Servers503
The Realities of Publishing and Maintaining a Web Site522
17Site Management525
Search Engine Promotion530
How Search Engines Work531
Optimizing for Search Engines534
Managing Web Sites538
Link Maintenance539
Content Management541
Part VIAdvanced Topics
The Need for XML547
SGML and XML548
Well-Formed XML549
Valid XML552
Displaying XML555
Combining XML and XHTML561
XML Application Languages565
Predicting the Future of XML573
Part VIIAppendixes
AHTML and XHTML Element Reference577
Flavors of HTML and XHTML577
Core Attributes Reference579
Language Attributes Reference580
Common Internet Explorer Attributes Reference581
Event Attributes Reference582
HTML Element Reference585
BCSS1 and CSS2 Reference735
Style Inclusion Methods735
CSS Measurements737
CSS Color Values737
Miscellaneous CSS Constructs741
CSS2 Aural Style Properties781
Microsoft Extensions to CSS781
CSpecial Characters789
"Standard" HTML Character Entities789
HTML 4.0 Character Entities807
Specifying Fonts819
Downloadable Fonts825
EColor Reference827
Browser-Safe Colors827
Color Names and Numerical Equivalents829
CSS Color Values835
FReading a Document Type Definition837
Element Type Declarations837
Occurrence Indicators838
Logical Connectors838
SGML Content Exclusion and Inclusion839
Attribute Declarations840
SGML and XML Keywords840
Parameter Entities841
The DTDs842
XHTML 1.0 Transitional DTD842
XHTML 1.0 Strict DTD862
XHTML 1.0 Frameset DTD878

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews