Posts Tagged ‘hide scripts and style codes from older browsers’

HTML Comment tag


The HTML comment tag is used to insert comments inside the code. All the text inserted inside this tag html comment tag will be ignored by the browser (with the exception of scripts and style codes in those browsers that support them) and invisible for the user. It's most common use is to "hide" scripts and style codes from older browsers (without support for it), so they don't show them as plain text.


This tag does not have any attribute.


There are no events defined for this tag.

Browser Support:

The comment tag is supported in all major browsers.

Difference between HTML and XHTML and HTML5:



A simple comment in the code (the comment is invisible).

Code View

html comment tag example

Comment's begin

Comment's end

In this case the tag is used to hide a script (in XHTML the script would be completely ignored by the browser).

Code View

html comment tag sample


Online Practice:

To Become more comfortable – Do Online Practice

Designed for