W3C home > Mailing lists > Public > www-validator@w3.org > October 2007

Re: [VE][141] This isn't really an error

From: Benjamin Niemann <pink@odahoda.de>
Date: Sat, 27 Oct 2007 22:49:03 +0200
To: www-validator@w3.org
Message-ID: <fg087s$ush$1@ger.gmane.org>

Hi Kristin,

Kristin Kramer wrote:
> Error [141]: "ID X already defined"
> 
> for uri
> 
> http://coco-luxe.com/chocolate_boutique/index.php?main_page=login
> 
> So what if I use the same id for each vertical nav div element so it does
> the same thing: float left with the same margin on the right.  Isn't this
> why we have CSS so we can "write once" -- how can this possibly be an
> "error?"

It is an error. ID - as it is defined - uniquely defines one element. There
are other uses for it than CSS, like referencing an element directly using
URIs like 'page.html#someid' or the JavaScript function getElementById() -
and both have no well defined behaviour, when there is more than one
element with a given ID.
There a more than one way to achieve what you want:
- give the elements that share some CSS properties a common CLASS attribute
and use a CSS selector .classname (instead of #id).
- use distinct IDs for the elements and use a CSS selector matching all IDs
(#id1, #id2, #id3 {...})


HTH
Received on Saturday, 27 October 2007 20:49:19 GMT

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