HTML <!-- comments --> Tag


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.


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

See the full list of HTML tags