Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML
IMCreator - Free Website Builder

HTML Comments

Before we go any further, I'd like to introduce the concept of comments. Although comments are optional, they can assist you greatly.

Comments are a part of the HTML code and is used to explain the code. The main thing to remember is that HTML comments are not visible to your website visitors. This can be helpful for other HTML coders when trying to interpret someone elses code. It can also be useful for yourself if you have to revisit your code in many months, or even years time. Comments aren't displayed in the browser - they are simply there for the programmer's benefit.

You write comments like this:

Code

Comments always start with <!-- and end with -->. This tells the browser when a comment begins and ends.

Example HTML Code:

CodeResult

Smile

As you can see, the comment is invisible to the user viewing the page in the browser. It is there, simply for the HTML coder's benefit.

Multiline comments (i.e. comments that span across multiple lines), use the same syntax as single line comments. You begin the comment with <!-- and end with -->. Whether the comment spans one line or ten, you still use the same opening and closing tags.

Well, we have now finished the first part of this tutorial. We have covered a lot, and by now, you have learned enough to build a website.

If you'd like to learn some of the more advanced HTML techniques, such as, how to create tables, frames, forms etc, please continue!

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!