<!-- YOUR COMMENT --> Element

By: Dusty Arlia
Published on Saturday, July 20, 2013, 05:39 PM
Last Updated on Monday, July 06, 2015 at 1:13 PM
Total Updates: 2

The HTML comment tag (<!-- YOUR COMMENT -->) is used to insert comments into your webpage code. Comments are not displayed in web browser windows. Also, HTML comments can "hide" scripts from browsers that do not support them.

Comments document the code's behavior. It can be easy to understand what the code is doing, but it can be difficult to understand WHY it is doing what it is doing. Adding a comment to your code will make it easier to understand when you have to read your code again later. It's also likely that someone else will be reading your code. The time you spend writing the code is short relative to the time you spend maintaining the code. Using comments is just like taking notes on a complicated subject - you want to make something complex easier to understand.