Try the HTML Course for Free!

Comments in HTML – Instructions

/ / HTML, Latest
A picture showing how to use comments in HTML code.

Overview of How to Add Comments in HTML

            This tutorial shows you how to add comments in HTML. You can insert comments into your HTML code as a form of documentation. They can also provide notes to yourself or other designers viewing your code.  Comments only appear within the HTML code and are not displayed by the browser.  One common use of inserting comments is to remind yourself of future editing tasks.

            To use the HTML comment tag, place your insertion mark cursor at the location in the HTML code where you want to type the comment. Then type the start of the comment tag by typing <!-- into the HTML code. Then type the text, code, or script you want to show in the HTML code as the comment. If needed, this can be multiple lines of content or even inline content. This content is not rendered by the web browser. Finally, end the comment tag by typing --> into the HTML code.

            The following table shows the starting and ending parts of the comment tag in HTML. It also shows an example of how you can write comments in HTML code.

Start of tag: <!--
End of tag: -->
Example: <p>Web browsers do not display comments.</p>

<!--Insert a picture of a web browser here.-->

<p>Web browsers ignore comments in HTML.</p>

Result: Web browsers do not display comments.

Web browsers ignore comments in HTML.

A picture showing how to use comments in HTML code.

A picture showing how to use comments in HTML code.

Instructions on How to Use Comments in HTML

  1. To use comments in HTML, place your insertion mark cursor at the location in the HTML code where you want to type the comment.
  2. Then type the start of the comment tag by typing <!-- into the HTML code.
  3. Then type the text, code, or script to show in the HTML code as the comment. This content is not rendered by the web browser.
  4. Finally, end the comment tag by typing --> into the HTML code.

Video Lesson on How to Add Comments in HTML

            The following video lesson, titled “Comments,” shows how to use comments in HTML to comment out HTML code. This video lesson is from our complete HTML5 and CSS3 training, titled “Mastering HTML5 and CSS3 Made Easy v.1.0.”

TOP
$199 $49 Entire Library! 0 Days 3 Hours 34 Minutes 42 Seconds      Get a better price
Ask For Coupon