How to Comment in HTML

In this tutorial, we will learn how to make comments in your HTML code. Comments in HTML allow you to leave notes for your self or other developers for future reference. It is import to note that HTML comments can be seen in your source code unlike PHP comments, so if you are publishing your code live don't leave any sensitive comments.

 

A comment in HTML is created using an opening and closing tag which wrap the content that is to be excluded from rendering. The opening tag is (two hyphens and a right arrow.)

 

HTML Comment Examples

Here are a few example HTML comments to show how they might be used.

 

<!-- The code below is a paragraph -->

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</p>

 

<!-- Enable this input later:
<input type="file" name="image" id="image">
-->

 

<!-- <script src="app.js"></script> -->
comment

Related Tutorials

 thumbnail

How to Comment in PHP

July 01, 2020
 thumbnail

CSS Comments

October 08, 2020