Home > Store

XHTML Example By Example

Register your product to gain access to bonus material or receive a coupon.

XHTML Example By Example


  • Sorry, this book is no longer in print.
Not for Sale



  • XHTML development—From syntax and style sheets, to tables, frames, forms, and scripts.
    • Provides students with everything they need to know to create rich XHTML applications for the desktop. Ex.___

  • Real-world example-based format.
    • Provides students with hands-on presentation of XHTML with examples they can use to add power and flexibility to their pages. Ex.___

  • Wide range of platforms—Desktop PCs, wireless phones, digital TVs.
    • Enables students to deliver content on a variety of platforms. Ex.___

  • Practical, real world applications.
    • Provides students with real world features that are currently available rather than focusing on the promise of extended future capabilities. Ex.___

  • Rationale for XHTML.
    • Demonstrates to students how XHTML bridges the gap between yesterday's HTML pages and tomorrow's sophisticated XML applications. Ex.___

  • HTML pages reformulated in XHTML.
    • Demonstrates to students how to reformulate pages without compromising compatibility with existing browsers. Ex.___

  • Case studies—Rich application targeted at the desktop and a lean wireless Web application.
    • Provides students with a step-by-step walk through of two different types of applications. Ex.___

  • Hundreds of professional, pre-made style sheet examples and ready-made scripts.
    • Provides students with an instant jump-start to designing Web pages. Ex.___

  • Extensive coverage of XHTML capabilities—XHTML CSS2 style sheet; using scripts to create interactive XHTML content; using forms and scripts to create pages with smart input capabilities.
    • Provides students with detailed explanations of language uses. Ex.___

  • Language benefits without excessive code.
    • Shows students how to craft professional, compelling pages without getting lost in unnecessary code. Ex.___

  • Tips, tricks, and warnings.
    • Enables students to immerse themselves in the language while avoiding the pitfalls. Ex.___


  • Copyright 2002
  • Dimensions: K
  • Pages: 768
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-040005-X
  • ISBN-13: 978-0-13-040005-5

Combine HTML's simplicity with XML's power—right now!

  • Learn XHTML hands on, through ready-to-use examples
  • Don't wait! Master XHTML techniques that work with today's browsers
  • Create rich media Web pages for the desktop—and "lean and mean" pages for next-generation wireless devices
  • Covers essential XHTML syntax, style sheets, tables, frames, forms, scripts, and much more
  • Written by International Standards experts who lead World Wide Web Consortium (W3C), Web3D Consortium (Web3D), and Motion Picture Experts Group (MPEG) activities

XHTML combines HTML's simplicity and accessibility with XML's unprecedented power and flexibility. With XHTML Example by Example, any Web developer can learn XHTML by example, simply and quickly, using hands-on examples and ready-made scripts and style sheets. Leverage your existing HTML skills to create rich, highly interactive XHTML sites—and learn how to deliver content on any platform, from desktop PCs to wireless phones. Best of all, discover how to gain XHTML's key benefits right now, with today's browsers and tools!

Authored by Aaron E. Walsh—XHTML Liaison to W3C for Web3D—and Dave Raggett—HTML lead architect and former W3C Activity Lead for XHTML—XHTML Example by Example covers XHTML development, from syntax to tables, style sheets to scripts.

Coverage includes:

  • Why you need XHTML, not just XML or HTML
  • Deploying XHTML on today's 4.x (and higher) browsers
  • Converting existing HTML pages to XHTML—painlessly
  • Creating static and interactive XHTML pages from scratch
  • Integrating forms and scripts to create pages with intelligent input capabilities
  • Enriching XHTML with XML-based languages such as SMIL, SVG, and MathML
  • Saving time and frustration with XHTML authoring, validation, and optimization tools

Filled with insider's insights and real-world solutions, XHTML Example by Example will help you deliver the next-generation Web sooner than you ever imagined.

Sample Content

Table of Contents



1. Why Bother?

Piecing Together the Web Development Puzzle. Stretching HTML to its Limit. XHTML Testimonials. Summary. Summary of URLs Found in This Chapter.


XHTML: Marrying HTML with XML. The Well-Formed XHTML Document. Three Flavors of XHTML. Understanding Markup Languages. Origins of Markup. Tags and Elements. Following Rules and Establishing Structure. Parsing Particulars. Presenting Style Sheets and DOM. Achieving Massive Scalability. Markup Languages for the Web. HTML. XML. Summary. Summary of URLs Found in This Chapter.

3. Wading into XHTML.

Introducing XHTML 1.0. Crafting “Strictly Conforming” Documents. Constructing Your XHTML Documents. Giving Your Documents a Basic Structure. Using <head> to Describe Your Documents with Meta Information. XHTML Versus HTML. Differences with HTML. HTML Compatibility Guidelines. Summary. Summary of URLs Found in This Chapter.

4. Making XHTML Sing.

Sounding off with Audio Files. Popular Web Audio File Formats. Weaving Audio into XHTML Pages. Linking to Audio Files. Creating Background Sounds for Internet Explorer. Embedding Audio Files with 'embed' and 'object'. Embedding Audio into Web Pages Using 'embed'. Embedding Audio into Web Pages Using 'object'. Combining 'embed' and 'object' for Cross-Browser Compatibility. Summary. Summary of URLs Found in This Chapter.

5. Making XHTML Dance.

Weaving Images into XHTML Pages. Linking to Image Files. Displaying Images Inline Using 'img'. Using JavaScript to Create Banner Ads and Image Rollovers. Creating Background Images and Colors. GIF. PNG. JPEG. JPEG2000 (J2K). Hooking Up Video. Entering the Third Dimension with Browser Plug-Ins and Java Applets. Plugging in Web3D Plug-Ins. Hooking Up 3D Java Applets. Summary. Summary of URLs Found in This Chapter.

6. Using Style Sheets to Format and Present Your Pages.

Introducing Cascading Style Sheets (CSS). Why Bother with Style Sheets? CSS Versions and Browser Support. Creating Style Sheet “Rules” in CSS. Understanding the “Cascade” in CSS. Linking and Importing External Style Sheets. Creating Document-Level Styles. Creating Element-Level Styles. Setting Background Colors and Images. Creating Text and Link Styles. Setting Link Colors. Coloring Headings, Paragraphs, and Other Text. Customizing Fonts. Controlling Page Formatting and Layout. Using Margins to Give Your Content Elbow Room. Summary. Summary of URLs Found in This Chapter.

7. Using Scripts to Bring Your XHTML Pages to Life.

Introducing JavaScript. Weaving Scripts into Web Pages. Internal Scripts Appear Alongside Markup. Using Comments to Hide Scripts from Older Browsers. Placing Scripts in Document Head. Specifying the Script Language and MIME Type. Managing the Many Versions of JavaScript. Using for Script-ignorant Browsers. External Scripts Reside Outside of Your Page. Inline Scripts Appear inside XHTML Elements. Ready-to-Use Scripts. Dazzling Visitors with Visual Effects. Blinking Colored Text. Fading Background Colors. Creating an Image Slide Show. Preloading Images for Smooth Image Rollover Effects. Animating Layers to Create Background Rain. Weaving Dynamic Sound Elements. Creating Pop-Up Windows for Page and Site Navigation. Enhancing Forms. Summary. Summary of URLs Found in This Chapter.

8. Using Forms and Scripts to Create Pages with Smart Input Capabilities.

Introducing Forms and the Element. From Springs Forth Forms. Combining Forms and Scripts for Smart Input. Instant Form Field Validation with Events and Regular Expressions. Creating Form Controls with Input Elements. Designing Smart and Secure Data Input Pages. Designing the Toys For Tots Donation Form. “Stitch”ing Together Your Own Bulletproof Form. XForms: The Future of Forms. XForms on the Horizon. XHTML-FML: Charting a Course for Future Forms. Background: The Scenario. No New Browsers = No Evolution. Rethinking “Browser”. The Vision. How It Works. Why the W3C Is Helping Us. Given this Magic Technology, Now What? Diving into XHTML-FML in 10 Short Steps. Rolling Your Own Interactive XHTML-FML Forms. Summary. Summary of URLs Found in This Chapter.

9. Using Tables to Organize Web Page Data.

Using Tables to Organize Data into a Grid of Rows and Columns. Understanding the Importance of Captions, Headers, and Footers. Creating Simple Tables Using and. Describing Tables with the Element and Summary Attribute. Adding Column Headers with. Grouping Rows into Head, Body, and Foot Sections Using. Creating Cells That Span Multiple Rows or Columns. Grouping Columns Using. Looking Good! Customizing the Appearance of Your Tables. Aligning Cell Data Horizontally and Vertically. Tweaking Cell Appearance Using Borders, Frames, and Rules. Adding a Dash of Style to Your Tables Using Css. Summary. Summary of URLs Found in This Chapter.

10. Gearing Up for the Rich Media Web.

Getting Ready. MPEG-4: A Multimedia Toolkit for Audio, Video, 2D, 3D, and Interactive Content. SMIL Enables TV-Like Multimedia Presentations. Making Sense of Your SMIL Presentation File. Scalable Vector Graphics Deliver 2D Vector Graphics, Images, and Text. Partitioning Screen Real Estate with Frames. Framesets Contain Frames Organized into Rows and Columns. Summary. Summary of URLs Found in This Chapter.

11. Where Do We Go From Here?

Reflecting on Your New Skills. The Future of Web Publishing with XHTML. Your Next Steps As a Web Guru.

Appendix A: XHTML Development Tools.

XHTML Development Tools. Stand-Alone XHTML Authoring Tools. HTML Tidy-Enabled Authoring Tools.

Appendix B: XHTML Quick Reference.

XHTML 1.0 Strict DTD. XHTML 1.0 Transitional DTD. XHTML 1.0 Frameset DTD.

Appendix C: Character Encodings.

Appendix D: Detailed Code Listing.

Appendix E: XHTML Basic and the Wireless Web.

Anticipating the Wireless Web and 3G Wireless. Unveiling XHTML Basic 1.0. XHTML Basic W3C Recommendation. W3C's Document Notice and License. Abstract. Status of the XHTML Basic Recommendation. Table of Contents. 1. Introduction. 2. Conformance. 3. The XHTML Basic Document Type. 4. How to Use XHTML Basic. 5. Acknowledgments. A. References. B XHTML Basic Document Type Definition.




Welcome to XHTML Example by Example. Written by professional Web developers, this book shows you how to get the most out of the Extensible Hypertext Markup Language (XHTML) without getting bogged down in rhetoric or code. This book focuses on what you really need to know to start using XHTML today. Using a variety of simple, practical, and real-world examples, it leads you step-by-step down the road of Web page development using XHTML and on your way to mastering this powerful and exciting foundation technology that enables the next generation of content for the World Wide Web.

About This Book

XHTML Example by Example was written by professional Web developers, specifically people new to XHTML. Whether you're a seasoned Web developer or a budding "newbie," this book will show you the essentials you need to know to get up and running with XHTML in no time flat.

Because we assume that you're already comfortable using basic Web development tools (such as text editors, FTP utilities, and Web browsers), this book walks you through many of the most important and useful aspects of XHTML irrespective of the tools that you use today. In other words, we focus primarily on how to write XHTML code, and we also introduce you to a few new XHTML-savvy tools, with an emphasis on creating high-quality Web pages.

Examples drive this book, as the title XHTML Example by Example implies, and the printed pages that follow are brimming with them. We provide you with several hundred examples, ranging from XHTML source code examples to "visuals" (stand-alone images, such as the one shown on page xvii), organized into the following 11 chapters:

  • Chapter 1, "Why Bother?"
  • Chapter 2, "XHTML = HTML + XML"
  • Chapter 3, "Wading Into XHTML"
  • Chapter 4, "Making XHTML Sing"
  • Chapter 5, "Making XHTML Dance"
  • Chapter 6, "Using Style Sheets to Format and Present Your Pages"
  • Chapter 7, "Using Scripts to Bring Your XHTML Pages to Life"
  • Chapter 8, "Using Forms and Scripts to Create Pages with Smart Input Capabilities"
  • Chapter 9, "Using Tables to Organize Web Page Data"
  • Chapter 10, "Gearing Up for the Rich Media Web"
  • Chapter 11, "Where Do We Go From Here?"
  • You can read these chapters in any order that you'd like, although we'd suggest that you start with Chapter 1 and progress through each subsequent chapter in a linear fashion if you're not already experienced with HTML. If you're already comfortable with HTML, however, you'll probably want to jump around from chapter to chapter as you chase down specific topics and examples that interest you.

    Online Reader's Area

    XHTML Example by Example represents a new dimension of technology books dedicated to advanced and cutting-edge Internet and Web topics. To get your hands on additional resources related to XHTML Example by Example, or to learn more about related technologies, visit the Web3DBooks.com online site (http://web3dbooks.com/).


    Submit Errata

    More Information

    InformIT Promotional Mailings & Special Offers

    I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


    Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

    This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

    Collection and Use of Information

    To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

    Questions and Inquiries

    For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

    Online Store

    For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


    Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

    Contests and Drawings

    Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


    If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

    Service Announcements

    On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

    Customer Service

    We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

    Other Collection and Use of Information

    Application and System Logs

    Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

    Web Analytics

    Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

    Cookies and Related Technologies

    This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

    Do Not Track

    This site currently does not respond to Do Not Track signals.


    Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


    This site is not directed to children under the age of 13.


    Pearson may send or direct marketing communications to users, provided that

    • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
    • Such marketing is consistent with applicable law and Pearson's legal obligations.
    • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
    • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

    Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

    Correcting/Updating Personal Information

    If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


    Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

    Sale of Personal Information

    Pearson does not rent or sell personal information in exchange for any payment of money.

    While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

    Supplemental Privacy Statement for California Residents

    California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

    Sharing and Disclosure

    Pearson may disclose personal information, as follows:

    • As required by law.
    • With the consent of the individual (or their parent, if the individual is a minor)
    • In response to a subpoena, court order or legal process, to the extent permitted or required by law
    • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
    • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
    • To investigate or address actual or suspected fraud or other illegal activities
    • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
    • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
    • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


    This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

    Requests and Contact

    Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

    Changes to this Privacy Notice

    We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

    Last Update: November 17, 2020