Lecture Notes – HTML Standards – Prepared by Sukh SandhuPage | 1 Concepts Why We Need Standards The World Wide Web, invented in the early 1990s, made it possible to distribute documents globally without worrying about what kind of computer or software the user had (as long as the user had an Internet-connected computer and a Web browser, of course). The way the Web was defined, the syntax of HTML was independent of computer type, and each kind of Web browser created was meant to display an HTML file correctly. At least this was the dream. The reality is that during the 1990s, economic and cultural forces muddied the waters. Some people made Web browsers that recognized HTML elements that had not been accepted as standards. Some companies created Web browsers fashioned to recognize company-specific (proprietary) HTML elements and attributes of elements. Some companies created Web browsers that recognized proprietary elements and attributes that were in conflict with the proprietary elements and attributes of other companies. Without standards, the World Web Web becomes fragmented. When you have to worry about what kind of browser you are using in order to see Web content, youre experiencing a problem that the Web was originally invented to solve. We need standards to make sure that all Web content is viewable by many different kinds of Web browsers--and not just the Web browsers of today, but the handheld devices, cell phones, or other Net devices that may be invented in the future. Using standards also lowers HTML production and maintenance costs. By educating HTML implementors in a fixed set of standards, you can reduce training time, increase the accuracy of implementation, reduce display
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> There are other DOCTYPE statements that you will need to use for other versions of HTML. For example, to use HTML 4.01 features andPage | 3 a "loose" conformance to syntax standards, you could use this DOCTYPE statement: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> You use another DOCTYPE statement when you create an XHTML document. For example, look at this simple XHTML document and use your browser to view its source to see its DOCTYPE statement. See the W3C site for more information on document types and DOCTYPE statements. The important thing to remember is that a DOCTYPE statement is essential to assisting validation software in checking your document. 2. Use tools that support standards. In particular, install and use the Tidy program or Tidy GUI on your computer. 3. Use validation to check the syntax of documents you create. 4. Refer to W3C for technical and syntax information. Having correct HTML syntax helps your Web sites usability in the widest range of browsers. However, dont become a "syntax snob"--one who proudly verifies and tweaks HTML pages to perfect syntax, yet ignores the meaning and content of those pages. Consider these HTML tips when you are making Web pages. Exercise: Check a Web document Use validation to check the syntax of documents you have created.
Validating a Web Document You can detect and diagnose HTML syntax errors in your document by using a validator. First, make sure you have an appropriate DOCTYPE statementPage | 4 (and, optionally, a character encoding statement) in your document. Then: 1. Go the the Web page http://www.htmlhelp.com/tools/validator/ 2. Enter the URL of your assignment in the box which is labeled URL: 3. Make sure that the checkbox for "show input" (second checkbox below the URL: box) is checked 4. Click on "Validate it!" 5. Fix the syntax errors you have. A good idea is to start with the first error that you have, fix it, and then re-validate. Repeat until you have no syntax errors. 6. If you want, you can use the Tidy service to help you. See The HTML Toolbox under "Utilities." Tidy can help you diagnose HTML syntax errors, but it is not a validator. Any output you get from Tidy should be run through the validator again