WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES
Advertisements

How to write comments in HTML

Topic: HTML / CSSPrev|Next

Answer: Use the Syntax "<!-- text -->"

Comments in HTML are typically used to explain the markup. It will help you and others to select or find the specific section in the document quickly and easily at the time of editing the source code. Comments are simply ignored, they are not displayed by the browsers.

An HTML comment begins with <!--, and ends with -->. Here's an example:

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  •     <meta charset="utf-8">
  •     <title>Comments in HTML</title>
  • </head>
  • <body>  
  •     <!-- This is a single line HTML comment -->
  •     <!-- This is an example of a
  •          HTML multi-line comment  -->
  •     <h1>This is a heading</h1>
  •     <p>This is a paragraph.</p>
  • </body>
  • </html>

Related FAQ

Here are some more FAQ related to this topic:

Advertisements

Your Feedback:

We would love to hear from you, please drop us a line.