HTML Comments Tutotials
1. HTML Comments
Comments are some text or code written in your code to give an explanation about the code, and not visible to the user. Comments which are used for HTML file are known as HTML comments. Anything written between these tags will be ignored by the browser, so comments will not be visible on the webpage.
Comments of any code make code easy to understand and increase readability of code.
Comments are also part of the code, which gives an explanation of the code.
2. How to add comment In HTML
You can add comments in your HTML file using <! -- ... --> tag. So if you will write anything between theses comment tag that will be treated as comment and browser will not read it.
<! -- Write commented text here -->
- <!-- <p>There is some text</p>
- <p>There is second text</p> -->
- <!DOCTYPE html>
- <!-- This is Header section -->
- <!-- Internal CSS -->
- text-align: center;
- background-color: #f0f8ff;
- font-size: 30px;
- color: red;
- <!-- This is body section, write code here which you want to display on web-page -->
- <!-- heading tag -->
- <h2>First WebPage</h2>
- <!-- Paragraph tag -->
- <p>Write your Content here!!!</p>
5. Multiline Comment
In HTML code, we can also comments multiple lines at a time. In multiline comment we can use any description about code or multiple line code to debug, etc.
- Your code is commented.
- Write description of code.
- It will not display at webpage.
<!-- This is image for a yummy cake
you can see it on your web-page
of your favorite browser -->
<img src="https://static.hpnmaratt.com/htmlpages/images/icecream.png" alt="icecream image" height="300px"