HTML and CSS Reference
In-Depth Information
T IP The support site www.htmlref.com has this reference online and may have updates or fixes to
this information.
<!-- ... --> (Comment)
This construct encloses text comments that will not be displayed by the browser. It may be
used for informational messages for developers as well as to mask content from user agents
that do not support a particular technology. No attributes or events are associated with this
construct.
Standard Syntax
<!-- ... -->
Examples
<!-- This is an informational comment that can occur
anywhere in an HTML document. The next few examples
show how style sheets and scripts are "commented out" to prevent
older browsers from misinterpreting the content.
-->
<style type="text/css">
<!--
h1 {color: red; font-size: 40px;}
-->
</style>
<script type="text/javascript">
<!--
document.write("hello world");
// -->
</script>
Compatibility
HTML 2, 3.2, 4, 4.01, 5
XHTML 1.0, 1.1, Basic
Firefox 1+, Internet Explorer 2+,
Netscape 1+, Opera 4+, Safari 1+
Notes
• Comments often are used to exclude content from older browsers, particularly those
that do not understand client-side scripting or style sheets.
• Page developers should be careful when commenting markup to ensure that other
comments are not included or that two dashes (--) are not embedded in the content
commented.
<!-- .[ ].. --> (Conditional Comment)
This Internet Explorer-specific comment style can be used to mask or include content,
depending on the browser in play.
Search WWH ::




Custom Search