W3C home > Mailing lists > Public > www-validator@w3.org > November 2001

Re: Problem in HTML, or bug in Wc# validator?

From: Clemens Radl <clemens.radl@uni-tuebingen.de>
Date: Tue, 13 Nov 2001 11:49:45 +0100
Message-ID: <001501c16c30$e82ba910$80260286@HSMA04>
To: <www-validator@w3.org>, "Robert Orenstein" <rlo@perforce.com>
Hi,

> Sorry if this is the wrong place to send this, but every reference
> I've looked at and everyone I've talked to has said that the following
> SHOULD validate:

No, it shouldn't.  IDs are supposed to be unique.  The IDs you use identify
the element they are used with for references to this very element.  What
you intend to do (apply the style "foo" to certain elements) can be achieved
by using the attribute "class" instead.

Regards,

Clemens

>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>
> <html>
> <head>
> <title>Just a test</title>
> <style type="text/css">
> <!--
> #foo {color:#006666}
> -->
> </style>
> </head>
>
> <body>
> <h1 id=foo>Test 1</h1>
> <h2 id=foo>Test 2</h2>
> </body>
> </html>
>
>
> ...but the validator gives the following errors:
>
>         Line 15, column 9:
>
>             <h2 id=foo>Test 2</h2>
>                    ^
>
>         Error: ID "FOO" already defined
>
> Line 14, column 9:
>
>              <h1 id=foo>Test 1</h1>
>                     ^
>
>         Error: ID "FOO" first defined here
>
> Any ideas?
>
> Thanks,
>
> Robert Orenstein
>
Received on Tuesday, 13 November 2001 05:49:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:00 GMT