HTML Comments Code

When coding HTML, you might want to place a comment in the code. An HTML comment is some text that is hidden from normal web visitors when they view your website in a browser. Note: They can still see your HTML comments if they "view source" though.

You can use the following HTML code to hide comments within your HTML document.

Example HTML Comments Code:

To hide text within your html codes, you simply surround it with opening and closing comment tags. The opening comment tag is <!-- and the closing tag is -->. Everything in between is hidden from the user (although they could still see it if they view the source code of the page).

CodeResult

The browser will display this comment because it is not surrounded by comment code.

You'll notice that the first comment was not displayed by the browser (because it was wrapped within the HTML comment code).

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!

Sponsored Link: Design CODE-FREE Websites

Check a Domain:

ZappyHost Logo
Webydo Banner Ad