HTML comment

  • Reading time:5 mins read

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.

 

html comments

 

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).

 

html comments

 

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.

-->

 

 

Summary

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:

JavaScript:

Java:

Other materials:

Learn to code and change your career!

100% ONLINE

IDEAL FOR BEGINNERS

SUPPORTIVE COMMUNITY

SELF-PACED LEARNING

Not sure if programming is for you? With CodeBerry you’ll like it.