Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 CSS styles in 1 page 1

Status
Not open for further replies.

aenema

Technical User
Nov 27, 2001
4
NL
I made a page with 2 tables which have their own different backgroundcolour. So now I need 2 different stylesheets for both tables. Is this possible? Really need to know this!

thanks in advance,

ænema
 
You can't use two css for the same TAG (table)
what you can do is use one with the TAG and the .your_name class in the second one.




Have Fun...

Sharky99 >:):O>
 
Hello aenema!

Sure you can!!! You can create two different stylesheets and link them to your page. Or you can create two styles in one stylesheet and link it to your page as well. Or you may create two styles inside your page. There are huge number of possibilities you may use, but the main idea - IT IS POSSIBLE!

Good Luck!
 
Both answers are right - you can define different styles for the two different tables, but you need to name the classes differently.

Styles:

.table1 { background-color: #FF0000 }
.table2 { background-color: #00FF00 }

HTML tables:

<table class=&quot;table1&quot; etc etc etc>
...
</table>

<table class=&quot;table2&quot; etc etc etc>
...
</table>

Whether you have your styles in-line (at the start of the HTML document) or in an external file (linked at the start of the HTML document) or in multiple external files, the classes need to be unique.

Regards,

Jon Wilson
Threespot Limited
 
Sorry about that, YES I KNOW we can use more than one css, what i meant is YOU CAN'T use two css for the same TAG unless you make a .class thanks Jon ;-)

and Eugene please read my post again, by the way maybe YOU understood but what about Aenema??? He's (or she's) the one who asked....


You can't use two css for the same TAG (table)
what you can do is use one with the TAG and the .your_name class in the second one.
Have Fun...

Sharky99 >:):O>
 
Hey Sharky99,

I didn't mean in any case that you were not right - I just had my own answer to aenema's question. Or you think that only you may reply? I'm sure you don't :)

And about your post - I've read it many times - you wrote how to use and I wrote only that it's possible. What's the problem? :)

And I think that you can't use two classes in one TAG, like
<table clas=&quot;first&quot; class=&quot;second&quot;>
but you can use two styles within one TAG, like
<table class=&quot;someClass&quot; style=&quot;color: red; ...; ...;&quot;>

Good Luck! :)
 
Thanks guys, but i already stole the sourcecode from altavista.com. The point wasn't to apply the css to the table, but to the links in the tabes. And now i understand the ieda of different .whatever classes.

mazzeltov,

ænema
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top