- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML Comments
HTML comments are placed in between <!-- ... --> tags. So, any content placed with-in <!-- ... --> tags will be treated as comment and will be completely ignored by the browser.
Single-line comments in HTML
Example
Let us see an example of single-line comments in HTML −
<!DOCTYPE html> <html> <head> <!-- Document Header Starts --> <title>This is document title</title> </head> <!-- Document Header Ends --> <body> <p>Document content goes here.....</p> </body> </html>
Output
This will produce the following output. The text in the comments never gets printed −
Multi-line comments in HTML
Example
We can also set multi-line comments in HTML. Let us see an example −
<!DOCTYPE html> <html> <head> <!-- Document Header Starts --> <title>This is document title</title> </head> <!-- Document Header Ends --> <body> <h2>Heading Two</h2> <!-- This is a multiline comment and it can span through as many as lines you like. --> <p>Document content goes here.....</p> <p>We have set comments in the document as well, but it won't get displayed.</p> </body> </html>
Output
This will produce the following output. The text in the multi-line comment won’t get displayed −
Advertisements
To Continue Learning Please Login
Login with Google