Home CS SEO HTML
Night More

Revise Now

Cambridge AS levels

Physics Chemistry Computer Science

Programming and coding

Learn HTML Learn SEO

More

What do you want
to do?

Contact us Donate Support More Services Send a tweet Social media




more topic chapters

HTML Comments

The comment tags in html are used to add comments!

Why do we use HTML comments

Like in all programming languages it is a good practic to use comments for your code as it helps you to describe the source code of the HTML document

However you need to know that:

Comments do not affect the content of the HTML page. So this is not visible to the user

We use comments for two different reasons

To explain the source code of the HTML document and for debugging and testing purposes

We use <!--This is an example comment --> to add comments to the source code

We will see a very simple example

This is the source code of the example

Then for most codes and examples we will run it

Run

As you can see there is no change however this makes the software developer to read the code more better

Debugging purposes

Rather than deleting the part of the HTMl content we could use thec comment tag to temporarily make the HTML code inactive for debugging purposes and to check where the error has occured.Let us see an example

Then for most codes and examples we will run it

Run

This shows the Heading tags are not run as it is within comment tags





Revisezone.com Copyright 2020 Developers & Coding section