HTML Comments


HTML HTML Comments Closing Tag For Comment

Html Comments

Comments tags are the tags that comment the source code.

<!-- Text inside these comments not shown in browser -->

Start Tag for comment is <!-- Closing Tag for comment is --> Note: There is no Exclamation Mark (!) in closing Tag. Code written in comments tag can't run(it is not displayed on browser).

Example

<!-- Paragraph --> <p> This is first paragraph. This is first paragraph. This is first paragraph.</p>

Output:

This is first paragraph. This is first paragraph. This is first paragraph.

Why Html Comments are Important?

These are Important for coder to Understanding of Code(As Each section of code is named).

Example:

<!-- Book --> <p> Book is best friend.Book is such a friend that never leave you alone.</p>

As checking code when look commented name(i.e Book Paragraph) came to understand that code is related to Book.

These are also good for debugger.(In case of any mistake in code debugger comment that section and debug other code).

Example:-

<p>I want to run this code</p> <!-- Code contains error and want not to run on browser. --><p>I want to run this code</p>

Output:

I want to run this code

I want to run this code

Note: The Gap in Output is due to Two different paragraph Tag. Not due to comments tags.
HTML Closing Tag For Comment Chapter Next »