Comments can be incorporated into your HTML code using the syntax below:
<!– Write your comments here –> |
Note: Comments are not rendered by the browser, yet they can aid in documenting your HTML source code. |
Using comments, you can insert notifications and reminders within your HTML code.
<!– write your comment here –> <p>This is a paragraph.</p> <!– your information here –> |
Comments can serve to conceal content, which can be useful for temporarily hiding it.
<p>This is a paragraph.</p> <!– <p>This is another paragraph </p> –> This paragraph will be hidden because the code is between <!– and the –>. <p>This is a paragraph too.</p> |
Hide section of Code:
<p>This is a paragraph.</p> <!– <p>Look at this cool image:</p> <img border=”0″ src=”pic_trulli.jpg” alt=”Trulli”> –> <p>This is a paragraph too.</p> |
In the above code the paragraph and the img tag are inside <!– and –> and will be hidden and wont display in the browser.
Comments are also invaluable for debugging HTML, as you can selectively comment out lines of HTML code one by one to identify errors.
Comments can be utilized to conceal sections within the HTML code.
Hide a part of a paragraph:
<p>This <!– great text –> is a paragraph.</p> |