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'

Postet Den:28/02/2011 Kl: 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

Forfatter: Philip Verghese 'Ariel'

Tilføj kommentar

Links som bliver tilføjet er uden rel="nofollow", men vil blive slettet hvis de bliver anset som spam.

[url=Absolutte URL til side]TITEL[/url]

Du skal bruge code tags rundt om kode eksempler, for at bevare mellemrum og linjeskift. Kode eksempler bliver kun syntax fremhævet, hvis du fortæller hvad for et sprog du bruger.

[code1 html|css|javascript|php|sql]Indsæt din kode her[/code1]

Du vil måske læse vores Privat Politik før du tilføjer en kommentar.