HTML - Comments

HTML Comments

HTML comments are words, phrase, sentences that are used explain or give brief description of what your code does.

  • It starts with <!-- and ends with -->
  • HTML comments do not display in your browser
  • HTML comments are of two types: Single line and Multiple line

OTHER IMPORTANCE OF COMMENTS

  • It helps you to remember what your code does.
  • It helps other coders to understand your code.
  • It is very useful in organizing your code in sections and categories.
  • It can be used as notes for proper explanation of code where need be.

HIDE ELEMENTS

HTML comments tags can be used to hide elements from displaying on the web browser. Reasons for this can be: for later usage; during debugging; special purposes.

  • Wrap the element with the opening tag <!-- and the closing tag -->
  • You can also wrap multiple comments if you wish.
tips
TIP:

Comments can also be used in between element contents to hide specific content(s).

note
NOTE:

<!-- This is the CORRECT comment -->

<! -- This is an INCORRECT comment -->

< !-- This is an INVALID comment -->

ADVERTISEMENTS

LEARNING IS A CONTINOUS PROCESS - PRACTICE MAKES PERFECT