DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Chara has posted 50 posts at DZone. View Full User Profile

Comments in HTML

01.29.2014
| 3664 views |
  • submit to reddit
<!-- This is a comment. Comments are not displayed in the browser. -->
 
<div id="header">
   <p>Some text</p>
</div> <!-- END div-header -->
 
<script type="text/javascript">
<!--
function ShowMessage()
{
  alert("Hello World!")
}
//-->
</script>

  The <!-- --> syntax is the HTML comment. This is the way to add your own notes into the code which will not display when the HTML is rendered by the browser. It is also a good practice for web-developers to use the comment tags to "hide" scripts from browsers without support for it (so they don't show them as a plain text).