Welcome to WebmasterWorld Guest from 54.224.160.42

Forum Moderators: incrediBILL

Message Too Old, No Replies

Tables: validator says I cannot use the ID more than once

     
3:40 pm on May 4, 2005 (gmt 0)

New User

10+ Year Member

joined:May 4, 2005
posts:12
votes: 0


I have a few tables on my website i was using this code
<TABLE id=table1>
<TR>
<TD bgcolor="#8B0000">
text here
</TD>
</TR>
</TABLE>
But i want a few tables that are exactly the same so i just repeated the code but html validator says that i have to use a different id everytime

Is there another code which i can use instead of id?

3:45 pm on May 4, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9068
votes: 4


Welcome to WebmasterWorld [webmasterworld.com], frisso.

As the validator says, you can only use an

id
attribute once on a page. Depending on what you're using it for, you may be able to replace it with a
class
attribute, which can be used multiple times.

<TABLE [b]class[/b]="table1">
4:06 pm on May 4, 2005 (gmt 0)

New User

10+ Year Member

joined:May 4, 2005
posts:12
votes: 0


Thanks
but that is not working do i have to change the css for <table class="table1"> to work
4:18 pm on May 4, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 22, 2002
posts:150
votes: 0


The prefix for class in your css is different to id.

IE. #table1 and/or .table1

6:34 pm on May 4, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 3, 2003
posts:44
votes: 0


frisso...

I believe the "id=table1" code you're referring to is the table ID that editors such as Frontpage automatically insert when creating a new table. It's not related to CSS styling. Since you did a copy-and-paste to duplicate the table, you either need to change the ID number for each copied table to something unique (eg: "id=table2", "id=table3", etc.), or you can possibly get rid of the ID's all together. Try changing the ID's for the copied tables and revalidate... it should work then.