Forum Moderators: not2easy
<table class="1st"> ....
<table class="2nd"> ....
Now I would like to assign another layout for these 2 tables and I try to set
<table class="1st" id="3rd"> ....
<table class="2nd" id="3rd"> ....
My IE6 seems have no problem to display these 2 tables.
Does this mean I can use the same id in 2 elements?
Thanks.
Always the first port of call. After that, if you still having trouble, let's talk ;)
Nick
well, why do you want to do this in the first place?
Normally, you use an id attribute for elements appearing only once on your page, e.g.:
<div id="navigation">...</div>
If you want to assign a style to more than one element, you should use a class, e.g.
.myclass {...}
.basic {...}
However, you can assign more than one class to an element like this:
<div class="myclass basic">...</div>
This means you could define for instance all you basic table attributes in the "basic" class and more special attributes in additional classes.
I hope this helps.
Now I would like to assign another layout for these 2 tables and I try to set <table class="1st" id="3rd">
One of the best tips I learned here from the CSS forum is that you can assign multiple classes to a single element (as TGecho and frank_stahl mention above). So, if you need to apply additional styling to those tables, you might do something like this...
<table class="ab cd ef gh">
Note: That is four different classes being applied to that one table.
After seeing that tip posted here at the board, I went on a mission to make changes on a multitude of sites where I was able to trim out some CSS bloat that had accumulated over the years.
As mentioned above, IDs can only be referenced once on a page. The validator will tell you the same.