Cleaning Up HTML

You’ve been reading about what great HTML code Dreamweaver writes, and how all you hand-coders need to get on the WYSIWYG bandwagon. But there are exceptions to every rule. In the process of formatting text, deleting elements, and—in general—building a Web page, it’s quite possible to end up with less-than-optimal HTML coding. While Dreamweaver usually catches potentially sloppy HTML, you may nonetheless run across instances of empty tags, redundant tags, and nested <font> tags in your Dreamweaver pages.

For example, if you attach a link to some picture and text, and later delete the linked item, Dreamweaver may leave the leftover code for the link in place like this:

<a href="index.html"> </a>

This empty tag doesn’t serve any purpose and only adds unnecessary code to your page. Remember, the less code your page uses, the faster it loads. Therefore, eliminating redundant tags can improve the download speed of your site.

Another possible source of errors is you. When you type HTML in Code view or open pages created by another program, you may introduce errors that you’ll need to clean up later.

Note

Dreamweaver MX is much better at housecleaning than Dreamweaver 4. You’ll have less clean up to do, because MX is far less likely to cause most of these problems in the first place.

Aware of its own limitations (and yours), Dreamweaver comes with a command that’s designed to streamline the code in your pages: Clean Up HTML. This command not only improves the HTML in your page, ...

Get Dreamweaver MX: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.