HTML Comments

By | January 4, 2020

Any HTML code has a specific purpose. We do not know which code is written for whom, therefore we use a comment which is called HTML comment.

<!-- ... -->

Browser ignores anything written between these tags that is it does not show on the web page. When we write a content, before that, in the comment, we write about that which makes the code easier to understand.


<h1>This is h1 Heading.</h1>

In the given example, the content written in <!– THIS IS H1 HEADING –>will not show on the browser as it is a comment while the content written in <h1> will show on the web page.


<!DOCTYPE html>
<!-- Internal CSS -->

<!-- style tag start -->
		color: red;
		font-size: 20px;
<!-- style tag end -->


<!-- body section start -->
	<!-- Heading Tag -->
	<h1>First Heading</h1>

    <!-- Paragraph tag -->
	<p>Lorem ipsum dolor sit amet.</p>

	<!-- Click The Link -->
	<a href="">Click Link</a>


<!-- body section end -->


Multiline Comment:-

In the HTML code we often need to comment multiple lines, which we can also name multiline comments.



<!-- Multiline Comment
Lorem ipsum dolor sit amet,
 consectetur adipisicing 
 elit. Quibusdam, iste!

<!-- Multiline Comment

<h2>This is heading</h2>
<p>Lorem ipsum dolor sit.</p>

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *