Html – Comments

Comments consider as a great help to new developers and an enormous way to locate little notes to you reminding yourself what segments of code are doing what. Comments are also important ways to mediate bugs and code errors, as they give you the capacity to comment out lines of code one at a time to search for the precise line causing problems.

HTML code comments as a sprouting young web developer consider as your friends! A comment is a way to control which lines of code are to be overlooked by the web browser and which lines of code to be included within your web page. There are three key reasons why you may want your code to be commented out or overlooked.

  • Comment out features passingly rather than deleting them, particularly if they’ve been left uncompleted.
  • Write notes or reminders to yourself within your real HTML documents.
  • Produce notes for other scripting languages like JavaScript which needs them.

Comment Tags:


As you can see, comments are include an opening and closing tag, (<!– –>). These tags can span across multiple lines of code like other HTML features which allow you to comment out huge blocks of HTML code. Any HTML features that are encapsulated within the comment tags will be overlooked by the web browser. This makes comment tags completely functional for debugging, since they allow the developer to passingly comment out segments of an HTML document without having to immediately delete the code from the HTML document.

HTML Comment Code:


Comment to self:


Locating notes and reminders to yourself is an important way to remember your thoughts and to trace features embedded within the web page. However, your code may exist for too many years, and these notes to yourself are an important way to recall what was happening, as you may not recall five or more years down the road.

All combinations of text located within the comment tags will be overlooked by the web browser. This contains any HTML tags, scripting language(s), etc.

html – <!– commenting existing code –>

You as a web designer may sometimes have various websites in progress at once, and it might be easy to leave some HTML features uncompleted. In this situation, you may comment out an feature until it is 100% prepare for the site. Below, since we are not completely prepare to accept input from our users we have commented out an input form feature.

HTML Code:


Now when we are prepare to show that feature, we can simply delete the comment tags, and our browser will willingly show the feature!

HTML Code:


Input Field:


Comment out features and bits of code that you may want to remember and utilize at a later date Deleting bits of code only to turn around moments later and realize that you now need to re code them is disappointing.


  • Regular use of comments lets you to remember your train of thought the next time you see the HTML code.
  • Commenting out features or code chunks helps debug without having to remove and then retype code.

Leave a Reply

Your email address will not be published. Required fields are marked *