• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 12. Editing the Code > Using Clean Up HTML

Using Clean Up HTML

Throughout the process of creating an HTML document, you may wind up with empty or redundant tags, unnecessary or improperly nested tags, and more problems with the HTML code in your document. Using the Clean Up HTML command gets rid of nearly all of these problematic instances. It is recommended that you run the Clean Up HTML command whenever you finish a page or site.

In the lighthouse_history.html document, choose Commands > Clean Up HTML…

The Clean Up HTML/XHTML dialog box opens. By default, the first two options under the Remove section are checked, and both options under the Options section are checked. The choices in the dialog box are as follows:

  • Empty Container Tags (<b></b>, <h1></h1>, …): Empty tags such as the example <b></b> (where there is nothing between the open bold and end bold tags) given in this dialog box can occur as you format text, particularly when you format, edit, reformat, etc. The more you work on a document, the more likely it is to have these kinds of nested tags. These tags may not cause problems in the browser, but they do take up space and make it harder to read through the code if you are editing in Code View. This option is checked by default.

  • Redundant Nested Tags: When you have a duplicate set of tags inside of a set of tags that do the same thing, the inner set of tags is redundant because the outside set has already made the definition. If this box is checked, Dreamweaver will remove all instances of a set of duplicate tags since they are unnecessary. This option is checked by default.

  • Non-Dreamweaver HTML Comments: Any comments that have not been inserted by Dreamweaver will be removed if this box is checked. This includes comments that have been inserted by you using Dreamweaver. Dreamweaver HTML Comments are those that are created by Dreamweaver in order to mark certain objects such as the <!--#BeginEditable "lighthouse" --> comment that signifies the editable region “lighthouse” in a template. Templates were covered in Lesson 9. This option is unchecked by default.

  • Dreamweaver Special Markup: Dreamweaver creates a number of tags that are not standard HTML. These tags include items (like <mm:libitem>, which signifies a library item) that indicate to Dreamweaver how specific objects should be handled. Only Dreamweaver recognizes this markup; browsers will ignore it. Use caution when checking this box, as it will cause all tags related to library items, templates, and tracing images to be removed. If this is done, you will no longer be able to update the page using those features. This option is unchecked by default.

  • Specific Tag(s): This text field allows you to instruct Dreamweaver to remove particular tags. If you want to remove multiple tags at the same time, separate the tags with commas. This option is unchecked by default.

  • Combine Nested <font> Tags when Possible: As you format text in your documents, <font> tags may become nested. For example, you might wind up with something that looks like this:

    									<font size="-1"><font face="Verdana, Arial, Helvetica, sans-serif">
    									<font color="#336633">Lights of the Coast</font></font></font>

    The three sets of font tags in this example can be combined into one <font> and </font> set, making the code much cleaner and leaner:

    								<font size="-1" face="Verdana, Arial, Helvetica, sans-serif" color="#336633">Lights of the Coast</font>

    This option is checked by default.

  • Show Log on Completion: The log will let you know what items Dreamweaver was able to clean up. This option is checked by default.


You can run this command on both HTML and XHTML documents. When cleaning up XHTML, you will have different options available to you.

Leave the default options selected and click OK.

Dreamweaver runs Clean Up HTML and displays a dialog box with the log of what was cleaned up. In this case, the message tells you that there was nothing to clean up.

Click OK to close the log. Save and close the lighthouse_history.html document.

Running Clean Up HTML helps to make your code as clean and free of errors as possible. It can potentially help decrease the file size and browser loading time for your document.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint