HTML <!-- comments --> Tag

Description

The HTML <!-- comments --> tag represents comments within your HTML code.

The basic tag is written like this <!-- --> with the comment text inserted between the <!-- and -->.

Comments are very common in programming languages. A good developer will write comments against each block of code so that any developer who views the code can quickly understand what each block of code does (without having to interpret the code first). Of course, these comments are not intended for website visitors to see - only for other developers. Therefore, anything written between the <!-- comment --> tags will not be displayed to the user (although if the user were to "View Source" they will see the comments).

Technically speaking, the <!-- comment --> tag is not actually an HTML tag/element. It is simply a means to allow comments to be added to the HTML source code.

Example

The following example shows the <!-- comment --> element in action. You can modify the code (on the left) and click "Refresh" to see your changes take effect (on the right).

Source CodeResult

Specifications for the <!-- comment --> Tag

Here is the <!-- comment --> element defined in the various specifications:

See the full list of HTML tags

About HTML.am

HTML.am was created in order to provide HTML tools, codes, tutorials, and other resources to help webmasters create and maintain their HTML documents.

HTML.am aims primarily at beginners, but may also be useful to web professionals.

About the HTML Codes

The HTML codes on this website are provided free of charge, for you to use however you wish. Feel free to modify the code to suit your own needs.

Need Hosting?

Our partner site ZappyHost provides website hosting, domain names and related products at some of the best prices on the web. If you need web hosting, check them out!