Web Standards Web Standards: Mastering HTML5, CSS3, and XML Gives You a Deep Understand- Ing of How Web Standards Can Be Applied to Improve Your Website
Total Page:16
File Type:pdf, Size:1020Kb
BOOKS FOR PROFESSIONALS BY PROFESSIONALS® Sikos, Ph.D. RELATED Web Standards Web Standards: Mastering HTML5, CSS3, and XML gives you a deep understand- ing of how web standards can be applied to improve your website. You will also find solutions to some of the most common website problems. You will learn how to create fully standards-compliant websites and provide search engine-optimized Web documents with faster download times, accurate rendering, lower development costs, and easy maintenance. Web Standards: Mastering HTML5, CSS3, and XML describes how you can make the most of web standards, through technology discussions as well as practical sam- ple code. As a web developer, you’ll have seen problems with inconsistent appearance and behavior of the same site in different browsers. Web standards can and should be used to completely eliminate these problems. With Web Standards, you’ll learn how to: • Hand code valid markup, styles, and news feeds • Provide meaningful semantics and machine-readable metadata • Restrict markup to semantics and provide reliable layout • Achieve full standards compliance Web standardization is not a sacrifice! By using this book, we can create and maintain a better, well-formed Web for everyone. CSS3, and XML CSS3, Mastering HTML5, US $49.99 Shelve in Web Development/General User level: Intermediate–Advanced SOURCE CODE ONLINE www.apress.com For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Download from Wow! eBook <www.wowebook.com> Contents at a Glance About the Author................................................................................................. xvii About the Technical Reviewer ........................................................................... xviii Preface................................................................................................................. xix Part 1: Web Standards............................................................................................1 Chapter 1: Introduction to Web Standards .............................................................3 Chapter 2: Internationalization.............................................................................39 Chapter 3: Markup Languages: More Than HTML5..............................................55 Chapter 4: Serving and Configuration.................................................................139 Chapter 5: Style Sheets.......................................................................................161 Chapter 6: Scripting and Applications................................................................213 Chapter 7: Metadata and the Semantic Web.......................................................245 Chapter 8: Web Syndication................................................................................307 Chapter 9: Optimized Appearance ......................................................................335 Chapter 10: Accessibility....................................................................................367 Part 2: Developing with Standards .....................................................................401 Chapter 11: Development Tools ..........................................................................403 Chapter 12: Putting It All Together .....................................................................419 Chapter 13: Best Practices .................................................................................443 Chapter 14: Validation ........................................................................................455 Chapter 15: Most Common Errors ......................................................................481 Index ...................................................................................................................491 iii PART 1 Web Standards In this part of the book, you will become familiar with the theoretical background behind web standards. You will learn the fundamental concepts of web site standardization, along with the standardization bodies that develop standards and the most influential web sites that announce, promote, and distribute them. You will learn about the importance of web standards and understand the reasons for incorrect implementations, along with techniques to correct or eliminate them. You will learn the web standards by category, from server configuration and internationalization settings to standard-compliant markup, style sheets, object embedding, metadata annotations, and news feeds. After reading these chapters, you will have a solid foundation of web standards and will be able to select the most appropriate standards for your projects. 1 C H A P T E R 1 Introduction to Web Standards Technical standards are widely used in various fields of life—think of the standards of paper size and the standard envelopes that fit them. Web standards, similar to other standards, are normative specifications of technologies and methodologies. In other words, they are well-defined sets of requirements to be satisfied. They are not only ideal from the technical point of view but also represent user needs. However, web standards are often ignored; the World Wide Web consists of billions of documents that do not consider proper restrictions or regulations, causing serious problems. This is because the Web is a “free forum” where everyone can publish even without a technical background. Unfortunately, this approach comes at a price: you will often encounter sites that download slower, have an inadequate appearance, or have poor functionality. Further, in spite of the benefits of standard compliance, not only content authors but also web developers find it difficult to implement web standards. One of the major reasons for that is the lack of widespread distribution. Even the most popular web sites can be very confusing, and in contrast to the common misconception, developers cannot use them as references to learn from. Moreover, many developers ignore standards because they think incorrectly that developing with standards means an additional workload. People have a limited knowledge about web standards, and they generally know neither the reason nor the optimal method for applying them. In this chapter, you will learn about the significance of web standards and the reliable resources you should know in order to make the best use of web standards in your own applications. Web standards are often ignored, causing serious problems that are described in the “Problem Statement” section later in this chapter. This chapter sets out the major benefits of web standards. It will also give you a solid understanding of the diversity and status of standards. After reading the chapter, you will be able to recognize finalized specifications and select the most appropriate ones for any project. The Basic Concepts Web standards are applicable to the World Wide Web (for short, the Web). These formal standards define and describe various aspects of the Web. According to the Web Standards Project, a major standards promoter, “Web standards are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the Web. Designing and building with these standards simplifies and lowers the cost of production, while delivering sites that are accessible to more people and more types of Internet devices. Sites developed along these lines will continue to function correctly as traditional desktop browsers evolve, and as new Internet devices come to market” [1]. Web standards are often de facto (in practice) standards. Since there is no law that enforces them, web standards are ignored by a large share of web developers. The Recommendations published by the World Wide Web Consortium (W3C), the largest web standardization body in the world, are not exceptions either. However, in November 2010, W3C made a big step forward when it became an ISO/IEC JTC 1 PAS Submitter because any stable core web technologies produced by W3C are also in the scope of ISO. The International Standards Organization (ISO) and the International Electrotechnical 3 CHAPTER 1 INTRODUCTION TO WEB STANDARDS Commission (IEC) can efficiently contribute to the wider, and, if possible, global, adoption of W3C standards by changing the status of de facto standards to de jure (in principle) [2]. Web site standardization refers to the development process of standard web sites or the correction of nonstandard sites to fulfill the requirements to become standard sites. This phrase has been recently associated with the philosophy of web design and programming that includes the application of widely accepted technologies, techniques, and best practices. The list also includes various tricks, as well as CSS and JavaScript hacks used by many developers, most of whom are not aware that these techniques should not be used. The main goals of standardization are functionality, interoperability, and browser and resolution independence in order to ensure user experience, access to content, menu usability, and predictable behavior. The Role of Standardization As you will see, there are several goals in web development, and they cannot be achieved without a standardized approach. How is it possible to use printers on a daily basis without paper-size standards? How could anyone use electric devices without standardized voltage? Why should