W3C home > Mailing lists > Public > www-html@w3.org > February 1996

Re: comments (Re: Really Quick Guide to Good HTML)

From: Ben Breakstone <bbreak@mit.edu>
Date: Wed, 21 Feb 96 16:46:50 EST
Message-Id: <v02120d03ad50fb00fb38@[]>
To: www-html@w3.org
Cc: boo@best.com (Walter Ian Kaye)
>>I frequently add comments to my web pages using the syntax
>><!-- This is a comment -->
>>My first few lines are fairly standard giving such information as my name
>>and a version number. I'm quite a bit more sparse with my comments in
>>HTML than I am in, say, C++. I guess I'm still trying to settle on a good
>>commenting style.
>Heh, you could always just use your C++ commenting style in a bracket. If I
>did so, mine might possibly look like this:
> <!--
<big comment snipped>
> -->

The only problem with this is that there are still some browsers out there
that don't properly handle comments, at least if they're in the <body> of
the document.  I had a few snotty little comments in the middle of some of
my web pages just for my own amusement, assuming that most people don't
look at the source.  I was shocked to see the comments rendered as if they
were a part of the page's text when I showed the page to a friend on his

I figured out that what this browser (and others, I found later) was doing
was terminating the comment sequence at the first line break.  So, while
<!-- hey, this is a comment, jerko -->
would remain invisible,
<!-- hey,
  this is a comment, jerko
would show up as "this is..." in the middle of the page.  I've found at
least two browsers that do this.  My understanding is that this is
nonstandard behavior, but still, I'm keeping all my non-single-line
comments in the <head> from now on.

Ben Breakstone      bbreak@mit.edu
      For PGP public key,
finger bjbF94@hamp.hampshire.edu
Received on Wednesday, 21 February 1996 16:48:37 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 30 April 2020 16:20:18 UTC