Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

HTML Comments Code

Print Version

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).

<!--
The browser will hide this comment because it is surrounded by comment code.
-->
<p>The browser will display this comment because it is not surrounded by comment code.</p>

This results in:

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 website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!