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

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 UTC