HTML standards


Published on

A draft standard for professional web page authoring, expressed in the language of ESA PSS-05 software engineering standards.

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

HTML standards

  1. 1. 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
  2. 2. errors, improve the appearance of Web pages, and make it possible for further maintenance with the least amount of hassle. I advise that you stick to HTML standards and validate your HTML files soPage | 2 that your Web pages are most likely to be satisfactorily displayed in the widest range of browsers and devices. The organization that coordinates HTML standards is the World Wide Web Consortium (W3C). You should bookmark their site as the best and most authoritative source for HTML standards. See also the Web Standards Project. Key things to keep in mind: 1. HTML standards help you reach the widest possible audience. 2. HTML is now specified as XHTML 1.0 (HTML + XML = XHTML). The expressiveness of XHTML 1.0 is quite impressive and complex. However, "plain old" HTML is still usable and quite useful. 3. There are many technologies that are associated with HTML because they are used on a Web page or in conjunction with HTML. But these technologies are not HTML: o CGI (Common Gateway Interface) o Java o JavaScript (JavaScript is also not Java) o Dynamic HTML (DHTML) o XML (Extensible Markup Language) o A variety of other emerging technologies. 4. Sometimes you are going to have to break the rules and use non- standard syntax for good reasons. Try to keep this to a minimum. How to Follow HTML Standards 1. Identify which version of HTML you are using in your document through the DOCTYPE line at the top of your file. For documents that use only HTML 2.0 features (like hello, world), you could use this DOCTYPE statement: <!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> For documents that use HTML 3.2 features, you could use this DOCTYPE statement:
  3. 3. <!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" ""> 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.
  4. 4. 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 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