The HTML Comment Tag: Here's How To Use It In Your Code

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Element of
HTML Document Structure Before And After HTML5 – Here’s What Changed
What does The HTML Comment Tag: Here's How To Use It In Your Code do?
This element is used to add a comment to an HTML document. An HTML comment begins with <!–– and the comment closes with ––>. HTML comments are visible to anyone that views the page source code, but are not rendered when the HTML document is rendered by a browser.
Display
inline

Code Example

You will be able to see this text.

<!-- You will not be able to see this text. -->

You can even comment out things in <!-- the middle of --> a sentence.

<!--
Or you can
comment out
a large number of lines.
-->

<div class="example-class">
Another thing you can do is put comments after closing tags, to help you find where a particular element ends. <br>
(This can be helpful if you have a lot of nested elements.)
</div> <!-- /.example-class -->
You will be able to see this text. You can even comment out things in a sentence.
Another thing you can do is put comments after closing tags, to help you find where a particular element ends.
(This can be helpful if you have a lot of nested elements.)
Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for html comment

iefirefoxchromeedgesafariopera
AllAllAllAllAllAll