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

Chapter 4. Editing Code > Inserting Comments

Inserting Comments

Comments are invisible notes you want to leave for yourself in the code—they won't show up in the browser window, but anyone can see these comments in the source code. You might want to add a reminder of when you created the file, when you last updated it, or who made the last revision.

You can also use comments to demarcate sections of a document, such as where a table begins and ends, or what part of the document constitutes the footer and copyright notice.

Comments look like this:

<!-- You can't see me -->

To add a comment

In either Code or Design view in the Document window, click to place the insertion point in the area where you want the comment to appear.

From the Document window menu bar, select Insert > Comment.


On the Common category of the Insert bar, click on the Comment button (Figure 4.87).

Figure 4.87. On the Common tab of the Insert toolbar, click on the Comment button.

If you're working in Design view, Split view, or the Code inspector, the Comment dialog box will appear (Figure 4.88). If you're working in Code view, you'll only see the opening and closing comment tags: <!-- -->

Figure 4.88. Leave a message for yourself or for future producers of the page by using the Comment dialog box. Dreamweaver enters the special opening and closing comment brackets for you.

Type the text you want to include in the comment in the Comment text box or directly into the code.

Click OK to close the dialog box.

If you have invisible element viewing turned on (View > Invisible Elements), you'll see the comment icon: .

In any case, you can look at the comment in the Code inspector (Figure 4.89) or Code view.

Figure 4.89. The comment appears in the Code inspector, but not in the Document window.

✓ Tips

  • You can view or edit the comments later on by selecting the Comment icon and viewing the Property inspector (Figure 4.90) or the Quick Tag editor (Figure 4.91).

    Figure 4.90. You can view or edit your comment in the Property inspector by clicking on the Comment icon in the Document window.

    Figure 4.91. You can view or edit your comment in the QT editor by clicking on the Comment icon and pressing Ctrl+T (Command+T).

  • To add comments to a file without storing them in the file itself and making them public, see Using Design Notes in Appendix O on the Web site for this book. You can also add comments to non-HTML files this way.

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