![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a div with a menu bar that I'd like to use as a php include so I can easily change the menu as the site grows. When I use teh 3WC validator I get 14 error messages. There are two kinds, "already defined" and "first defined here". For example: Line 200, column 8: ID "NAVLIST" already defined ul id="navlist" An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hock for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element). Line 184, column 8: ID "NAVLIST" first defined here ul id="navlist" I find this confusing. Can anyone please tell from this what I have done wrong? Thanks, Chris (Hunt) |
#3
| |||
| |||
|
|
Chris (Hunt) wrote: I have a div with a menu bar that I'd like to use as a php include so I can easily change the menu as the site grows. When I use teh 3WC validator I get 14 error messages. There are two kinds, "already defined" and "first defined here". For example: Line 200, column 8: ID "NAVLIST" already defined ul id="navlist" An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hock for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element). Line 184, column 8: ID "NAVLIST" first defined here ul id="navlist" I find this confusing. Can anyone please tell from this what I have done wrong? Thanks, Chris (Hunt) The validator sees the same id (#NAVLIST) twice on the same page. If that's not your intention, make it a class, i.e. with a dot before in the stylesheet (.NAVLIST) and thn you probably need to change the objects' tags to have class="NAVLIST" instead of id="NAVLIST". However, show the URL so that we can see the code. Else, the above is merely a guess. -- Dan Vendel - *GOF* "Eagles may soar, free and proud, but weasels never get sucked into jet engines." Contact: http://www.proformica.com/contact.shtml Call or chat me via Skype ID: danvendel, but DON'T ask questions that you can ask here! (get Skype at http://skype.com) |
#4
| |||
| |||
|
|
Thanks for the reply. The url is: http://www.wisehat.com/resources/games/bombsaway.php |
#5
| |||
| |||
|
|
Chris (Hunt) wrote: Thanks for the reply. The url is: http://www.wisehat.com/resources/games/bombsaway.php Yes, an "id", i.e. a style that you define with a #, is only supposed to occur once on each page. In your case, it appears several times. Make it a class instead, since that allows you to apply it on as many elements as you wish. Try this: In the stylesheet, change all instances #navlist to .navlist In the pages (and includes), change: id="navlist" to: class="navlist" I think that'll do. But I'm not a CSS guru, so try and see what happens, then check back here if the more knowledgeable people have made any comments. -- Dan Vendel - *GOF* "Eagles may soar, free and proud, but weasels never get sucked into jet engines." Contact: http://www.proformica.com/contact.shtml Call or chat me via Skype ID: danvendel, but DON'T ask questions that you can ask here! (get Skype at http://skype.com) |
#6
| |||
| |||
|
|
Thanks Dan, You were right - making the changes you suggested allows the page to validate. Unfortunately it also means I lose the colour scheme. I had this #navtitle and #navlist. Both repeated. I changed them to classes but the background colour of #navtitle changed and all the text changed colour as well. I can't work out how to change it to what I want without repeating ids which means it won't validate. Chris I'm far from a CSS guru either, but I think I can help. If you open the |
![]() |
| Thread Tools | |
| Display Modes | |
| |