Home  >  Article  >  Web Front-end  >  How to create hidden comments in HTML?

How to create hidden comments in HTML?

WBOY
WBOYforward
2023-08-31 15:05:061357browse

How to create hidden comments in HTML?

Comments are used to hide content.

To create hidden comments in HTML, we add tag and end it with -- >. Whatever comes inside this tag it is hidden. These comments allow us to easily understand the code.

Comments can be viewed as comments to yourself, and can also allow others to understand the code, while hiding the HTML code so that the browser will not display it on the web page.

grammar

The following is the syntax for hiding comments in HTML.

<!—The text to be commented -->
The Chinese translation of

Example

is:

Example

The following is a sample program to hide comments in HTML.

<!DOCTYPE html>
<html>
<body>
   <!-- The text here is a commented and it is hidden on the web page -->
   <p>DLF stands for Delhi Land and Finance</p>
</body>
</html>
The Chinese translation of

Example

is:

Example

Following is another example program to hide comments in HTML.

<!DOCTYPE html>
<html>
<body>
   <!-- <ul>
      <li> 1 </li>
      <li> 2 </li>
      <li> 3 </li>
   </ul> -->
   <p>Delhi is the capital of India</p>
</body>
</html>

We use inline comment tag inside the

tag. To hide the content of the paragraph.

The Chinese translation of

Example

is:

Example

The following is a sample program to hide comments in HTML, using inline comment tags.

<!DOCTYPE html>
<html>
<body>
   <!-- The text here is a commente and it is hidden on the web page -->
   <p>DLF stands for Delhi Land and Finance<!--FinanceDelhi Land and Finance is one of the largest commercial real estate developer in India.--></p>
</body>
</html>

The above is the detailed content of How to create hidden comments in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete