Computer Science, asked by shrutigupta4836, 10 months ago

What is a comment? How do you add comments in a HTML document? Explain with the help of an example.

Answers

Answered by shilpa85475
9

COMMENT:

A comment is an opinion or an expression regarding a particular thing. The comments one wish to express are generally incorporated into the source code with the help of the comment tag in a HTML document.

Explanation:

The comments you inserted are not displayed in the browser rather these comments are used to edit your source code at a later point of time. It will mostly help us to document our code and to debug our code whenever we are in need.  

The syntax which is used to insert comments to your HTML document is as follows:

<!------- your comments ---->

The exclamation mark should be placed before the starting of the comment section but not in the end.

Example:

<!DOC TYPE html>

<html>

<body>

<!--This is an example of a comment -->

<p>Welcome to my site</p>

<!-- the browser will not display your comments -->

</body>

</html>

OUTPUT:

Welcome to my site.

Similar questions