Definition and Usage
When you work with code, you often find yourself in need of some comments to make sense of the code and to document things in the code. This is when the HTML comment tag can be useful.
You use this either by just writing a comment in proximity of a set of code, but you can also use it to comment out blocks of code. This is done by placing the starting tag before the block of code and then the closing tag after the block of code.
The HTML comment tag will not show in the browser, but it will be in your code for anyone that inspect it.
Example code
<!--This is a comment. Comments are not displayed in the browser--> <p>This is a paragraph.</p>
Click the Code tab above to see this in action.
Code Example
This example is using CodePen.io and it is editable. Feel free to play around with it as none of your changes will be saved and it is only visible to you. In order to interact with the code example you might need to click on the "Run Pen" button. If you want to explore this on Codepen directly, then click here.
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now