Comments in HTML

Posted The: 14/04/2008 At: 19:24

Last Edited: 30/04/2009 At: 20:55

As the author you will be able to use comments, either for your own convenience, or to help other/colleagues understand the code.

When to use Them

When working with Client-Side scripts, or whith complex div layouts (css based layouts).

Or when you want to explain something in the code, for future Web Designers who may take your place.

Example

When writing comments in HTML, you would do it like below.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

  <head>
    <!--This is a HTML comment-->
  <title>My first Website</title>
  </head>

  <body>
      <p>My first Website.</p>
    <!--This is a HTML comment-->
  </body>

</html>

In HTML, comments start with "<!--" and ends with "-->".

Comments: [0]

© Brugbart Webdesign