What is the HTML comments tag?

Last Update: Apr 26 2024 | BY: AK Shukla

A

Alka Patel

HTML Comment Tag

The HTML comment is used to ignore a piece of HTML code being rendered in a web browser, simply if you want to hide some HTML content then you can comment on that content, but note that this is not a way to hide something secret because commented HTML content can be seen in source code of a webpage by end-user. 


Most commonly, there are two types of comment tags used first one single-line comment <comment> tag and another one multiple-line comment <!-- ..... --> tag to hide code.

<comment> Tag 

  • <comment> tag is supported by only a few browsers like IE, it is not recommended to use, so try to not use <comment> tag.
  • <comment>t tag has both opening and closing tags, see below example.
  • <comment><p>This paragraph is commented</p></comment>

<!-- ... --> Tag 

This <!-- ... --> is most widely used and supported by web browsers, it is very easy to use, just type all HTML content between <!-- opening and --> closing tags, like the below line. 

  • <!-- content goges here -->, see below example
  • <!-- <p>This paragraph is commented</p> -->

1 votes

P

priyanka pidurkar

<!---->

1 votes

S

Sunita Verma

The HTML comment tag is used to ignore a piece of HTML code being display on a web page. Commented codes are visible in source code but they are not rendered in the web page.

0 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)