HTML comment syntax:
<!-- Comment -->
Comments help you document issues, uncertainties and special solutions that may arise during coding. You can benefit from writing comments for yourself, but it’s especially useful if others are working on/with your code too.
You can place notes or reminders, and one of the biggest benefits of comments is that they can help when debugging HTML. You can also add comments when looking for errors, either in your own code or when you are checking someone else’s.
How to add comments to the HTML code? – comment tag
This is how a comment tag looks:
<!-- Write your comment here -->
It is important to note that there is an exclamation mark at the beginning of the tag, but not at the end.
Comments do not appear in the browser, only in the editing interface (i.e. in the code editor or text editor where you are working).
Multi-line comments – HTML multiline comment
Previously we showed single-line comments, but HTML supports multi-line comments as well. To write a longer comment, open the comment tag,
and start typing the comment on the next line, then close the tag on the line after the comment.
If you’d like to see more programming tutorials, check out our Youtube channel, where we have plenty of video tutorials in English.
In our Programming Tutorials series, you’ll find useful materials which will help you improve your programming skills and speed up the learning process.
HTML and CSS:
- HTML color codes
- How to create perfect HTML tables
- Best way to create HTML table with HTML and CSS
- How to create perfect CSS background images
- How to center an image in HTML?
- How to change background color in HTML?
- How to disable scrolling in HTML?
- How to change text color in HTML?
- How to link CSS to HTML?
- HTML comments