Composing Good HTML

Note: This document is available as both a single document (suitable for printing) and a multi-part document (more appropriate to hypertext). There is also a postscript version available via FTP, at jupiter.willamette.edu, as /outgoing/jtilton/strict-html.ps. These multiple views are automatically generated with a Perl script called "multiview".


What's New with this document

New (Dec 11, 1995): A new version of CGH is available, although I wouldn't recommend making any anchors to it. It will replace this version within the next week, once I finish spiffing it up. In the meantime, you can preview it at http://www.cs.cmu.edu/~tilt/cgh/cgh-new.html. This coincides with the release (finally!) of Web Weaving, from Addison-Wesley.

New (April 26, 1995): This document will appear in substantially revised form this fall as a chapter in a new book from Addison-Wesley, Web Weaving (ISBN 0-201-48959-7), by Tilton, Steadman, and Jones; the book will address issues of creating and maintaining Webs as infostructures that are relevant, usable, and maintainable. Watch this space for upcoming details.


Introduction

As the Web continues to explode in its own inimitable fashion, it is becoming more and more important to write HTML that conforms to certain guidelines. Specifically, with the current diversity of clients for the Web (and we can only expect to see more!), it's become important to write HTML that will look good on any client, and not just on the specific client which the author may have access to.

To that end, there are a few solutions. One approach is this one -- documents which point out common errors one might make in the composition of HTML. The other approach is software based -- a "lint"-like program for catching semantic errors in HTML, and perhaps even correcting them (for this, you should examine either WebTechs' HTML Validation Service or WebLint, two services which I have failed to list here for far too long). Several astute observers have noted that "Composing Good HTML" contains some HTML errors -- although there's a reason for that.

The thing to bear in mind is that, if you follow these guidelines, your document may not look as best as it possibly can on a particular browser. However, it also will not look ugly on any browser, which is the risk you take by disregarding these recommendations and tweaking your HTML for, say, Mosaic. Unfortunately, Mosaic may render things differently from Lynx which may render things differently from TkWWW, etc, etc, etc. These guidelines, in essence, should ensure the best fit across the space of all possible browsers, if you get my drift.

This document does not purport to be a style guide, or a beginner's manual to HTML. Fine documents already exist for these purposes.

(Note: This document is fairly stable, but still open to amendment. Please feel free to comment on that which is missing, wrong, right, or silly. Especially, please point out anywhere that I don't follow my own guidelines -- I'll slink back and fix it, I promise! Thanks to everyone who's already done so!)


Contents of this Document

For More Information

There already exist documents on the Web which address this same topic, and perhaps in more detail. For definitive reference information you may wish to check the HTML specification from the World Wide Web Consortium (W3C). For a more detailed discussion of HTML composition style, you should also check the Style Guide (especially the section on device-independent formatting), which is also from the W3C.

If you're looking for a good document for learning the basics of HTML, you will want to check out the Beginner's Guide to HTML, from NCSA.

Acknowledgements

I'd like to thank all of you who have visited this document and commented on it, suggesting fixes, clarification, and even new sections. You know who you are (even if I managed to lose your addresses in the flood of information)! It is, in some senses, still a work in progress and is always amenable to suggestion, modification, and repair. I appreciate your help!


Copyright © 1994, 1995 by Eric Tilton. Permission is granted for individual use and reproduction provided that this document remains intact, with this copyright message clearly visible. Commercial use and reproduction rights are held by Addison-Wesley, and this document may not be resold or redistributed for compensation of any kind without prior written permission from Addison Wesley -- contact me for details. Parts of this document appear in a revised form in the upcoming book, Web Weaving (ISBN 0-201-48959-7), by Eric Tilton, Carl Steadman, and Tyler Jones, to be published by Addison-Wesley. Look for it in a bookstore near you!

The upshot is, this document has always been meant as a public service, and will remain a public service. I hope you've found it to be useful; I've had fun providing it for your use.


Last modified: Jan 15, 1996

James "Eric" Tilton, HTML Guru Wannabee, jtilton@willamette.edu