While writing HTML codes, you may want to write HTML comments to easily understand HTML codes. Adding comments in HTML codes for each line clear the purpose of adding that code. This is the best way of coding for developers and programmers.
What are HTML Comments
HTML Comments are the lines visible only in the codes and not in the frontend to the users. Means, there is no effect in the view of your page. These are used to explain the purpose of adding markup codes.
You can find each section of codes easily using the comments in HTML. You can easily analyze the source code in just one view of comments.
How to Write HTML Comments?
To write comments in HTML, you have to add the text inside the starting tag
<!-- and the end tag
-->. You can add texts as well as the HTML codes inside the comment tags.
<!--Commented text will comes here-->
This is the single line comment in HTML. However, if you want to add the multiline comments in HTML. You don’t need to use any other tags and can use the same tag as given above.
To add the multiline HTML comments in HTML codes, check the example given below. The below example contains the heading and the paragraphs. You can comment these line of HTML codes using the same starting tag
<!-- and end tag
<h2>This is the heading in HTML</h2>
<p>This is paragraph in HTML.</p>
<span>This is the span tag in HTML.</span>
If you want to add as many lines as you want, they all should come under the comment tags given above will consider as the HTML comments. You can add HTML tag inside the HTML comments to make them commented.
You may also like.
Hope, you like this tutorial. If you have any query regarding the HTML comment system. You can comment below to get the solution.