Comments in HTML

Reference on HTML Comments. Covers their use in Web-design, and some background information.

Comments can be written directly in the HTML source, and will be ignored by browsers.

Writing comments in HTML can be useful when trying to understand what the different parts of your code is doing. It can also be useful when you are multiple people working on the same code, since everyone might not have the same level of understanding of the code as you do.

Example

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

<!DOCTYPE html>
<html lang="en">
  <head>
   <!--This is a HTML comment-->
   <title>My first Website</title>
  </head>
  <body>
   <h1>My first Website.</h1>
   <p>This example shows how to write comments in HTML</p>
   <!--This is a HTML comment-->
  </body>
</html>

Brugbart Vision!

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

Comment by Philip Verghese 'Ariel'

Posted The:28/02/2011 At: 20:12

Hi Brugbart,

Good to visit your informative and educative site

Today I learned some basics of HTML lan.

Thanks for your effort to put these tutos in order

Keep inform

I couldn't find a follow button here anyways you are available at twitter and fb

best

philip

Author: Philip Verghese 'Ariel'

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.