Versión en español



 


HTML Comment tag


Note: If you don't know what a tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.

Table of contents


Description

The HTML comment tag is used to insert comments inside the code. All the text inserted inside this 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.

Note that when writing XHTML code the commented scripts and style codes are completely ignored by the browser.

Attributes

This tag does not have any attribute.


Events

There are no events defined for this tag.

See complete list and information about events in HTML


Examples

A simple comment in the code (the comment is invisible).
Code View
<p>Comment's begin</p>
<!--Here is the comment text-->
<p>Comment's end</p>

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
<script type="text/javascript">
<!--
function gimme_a()
{
return 'a';
}
-->
</script>



Bypass footer options  |   Send to a friend Send to a friend  |  Post to del.icio.us Post to del.icio.us

Digg this page Digg this!  |  File on Furl File on Furl  |  Add to Yahoo! MyWeb Add to Yahoo! MyWeb

Bypass W3C declarations | 

Valid XHTML 1.0 Strict  |  Valid CSS Why should you trust us? Click the images on the left to see how seriously we write our own pages, then make your choice.

Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0. This website gives its best effort to achieve the Level Triple-A Conformance, W3C-WAI Web Content Accessibility Guidelines 1.0. If you find any detail or error that we didn't see, don't hesitate and let us know.

The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. -- Tim Berners-Lee, W3C Director and inventor of the World Wide Web.

 Link to us  |  Contact us  |  Beyond HTML  |  Tools and resources  |  Sitemap  |  Webmaster