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

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 UTC