Welcome to WebmasterWorld Guest from 54.204.100.232

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)

10+ Year Member



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)

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



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)

10+ Year Member



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)

10+ Year Member



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)

10+ Year Member



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.