|
Navigation: How to... > Format and Fix HTML Automatically |
![]() ![]()
|
The HTML Tidy Tool is capable of automatically fixing certain issues and changing HTML to XHTML and XHTML to HTML. In addition, it can also format ("pretty print") your HTML/XHTML pages to be more readable.

How to Format and Fix HTML
| 1. | In the editor, open the document you want to format and fix (make sure it is the active document). |
| 2. | Choose Tools->Format and Fix HTML (with dialog) or press Ctrl+F11. You can also choose the no dialog option to immediately process the document with the last settings of the HTML Tidy Tool dialog box (no dialog box will open). |
| 3. | The HTML Tidy Tool dialog box should open with the HTML Tidy output in the Fixed HTML tab if HTML Tidy was able to format and fix the document. If the document contains errors, then view the Tidy Messages tab to see HTML Tidy's messages and then click the Cancel button and use the editor to try to manually fix the errors that HTML Tidy could not fix. Try using the HTML Tidy again when you've made the corrections. |
| 4. | Assuming HTML Tidy was able to format and fix the document, the document source will appear in the Fixed HTML tab. However, because HTML Tidy is not perfect, there may be problems with the "fixed" document so you should compare the fixed and original documents. You can compare the browser view of the fixed HTML versus the original HTML using the Browser View (Fixed) and Browser View (Original) tabs. If the Browser View (Fixed) tab indicates a problem with the HTML Tidy changes, then you may not want to accept the changes. You should also consider the CSE HTML Validator validation results (if enabled). If CSE HTML Validator detects more problems (more errors and warnings) with the tidied document than with the original document, then you should consider not accepting the changes. |
| 5. | You can change HTML Tidy options to get different results. For example, you can change the profile, checkbox options, and other options. If you do, click the Refresh button to re-run HTML Tidy with the new settings and to update the tabs. For more details about the options, see the HTML Tidy Tool topic. |
| 6. | If you are satisfied with the changes, click the OK/Accept button to update the document in the editor with the changes made by HTML Tidy and to close the HTML Tidy Tool dialog box. If you are not satisfied, then click the Cancel button to cancel the changes. |
NOTE: It is possible that HTML Tidy may make changes that you do not want or that are incorrect. Be sure to keep backup copies of the original documents. It is possible that you may need to revert back to the original documents or to reference them for some reason after HTML Tidy has made changes to them.
See the HTML Tidy Tool topic for more information.