HTML comments codeComments are used in html to hide some text or code from the browser. Usually comments are used to explain a part of the code to the designer or coder. Some time to break the coding area and to mark different landmark portions, comments are used.
HTML comments are not displayed by the browser. So in any portion of the text or code we don’t want to be displayed or to be ignored by the browser but should stay in the file then we should use comments in html code.
Note that the comments will be available for viewing if we check the view – source code of the page.
If we are using any server side scripting language like PHP then the comments for PHP will not be available to the browser.
Writing comments in any language is a good practice and it makes the code maintenance easy.
Here is the code to generate comments in html
<!-- Line 1this text is commented and not visible -->
The output of above code is here