Using Clean Up XHTML


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

1.

In the asana.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:

  • Remove 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 textparticularly when you format, edit, reformat, and so on. The more you work on a document, the more likely it is to have these kinds of nested tags. These tags might 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.

  • Remove 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. As you work in a document, redundant nested tags can occur. If this box is checked, Dreamweaver removes all instances of a set of duplicate tags because they are unnecessary. This option is checked by default.

  • Remove Non-Dreamweaver HTML Comments: Any comments that have not been inserted by Dreamweaver are removed if this box is checked, including comments that have been inserted while using Dreamweaver. Dreamweaver HTML Comments are those that are created by Dreamweaver to mark certain objects such as the <!--#BeginEditable "teachers" --> comment that signifies the editable region "teachers" in a template (refer to Lesson 13). This option is unchecked by default.

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

  • Remove 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: If your document uses <font> tags, these tags might become nested as you format text in your documents. For example, you might wind up with something that looks similar to this:

     <font size="1"><font face="Verdana, Arial, Helvetica, sans-serif"> ¬    <font color="#336633">Yoga Sangha</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">Yoga Sangha</font> 

    This option is checked by default.

    Note

    The <font> tag is deprecated in HTML 4.0that is, it might become obsolete in future versions of HTML. Styles sheets are recommended for text formatting instead.

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

2.

Leave the default options selected and click OK.

Dreamweaver runs Clean Up HTML and displays a dialog box with a log of what was cleaned up. In some cases, there might not be anything to clean up.

3.

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

Running Clean Up XHTML 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.

Note

To further optimize the code in your documents, you can run Validate Markup to examine the code for tag and syntax errors by choosing File > Check Page > Validate Markup or selecting the Validation tab in the Results window and clicking the Validate button (the green triangle on the left). Any errors found will be displayed in the Results dialog box.





Macromedia Dreamweaver 8(c) Training from the Source
Macromedia Dreamweaver 8: Training from the Source
ISBN: 0321336267
EAN: 2147483647
Year: 2006
Pages: 326

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net