Reply
css inheritance, or making a class like another
Old 05-27-2005, 04:37 AM css inheritance, or making a class like another
bez
bez's Avatar
Skilled Talker

Posts: 53
I have 2 classes in CSS that have different names but all the same rules. To save bandwidth id like to know if i can make one equal the other, something like:

.reservationTable{
.sessionTable
}

(doesnt work)

Even better, can you make one the parent class of the other (so it contains all the same rules but can be extended)?

Copy & pasting big chunks of CSS seems like such a clumsy way of doing this.

Thanks for any feedback
bez is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-27-2005, 05:54 AM
chrishirst's Avatar
Super Moderator

Posts: 13,626
Location: Blackpool. UK
.reservationTable, .sessionTable {
definitions
}
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-27-2005, 06:32 AM
bez
bez's Avatar
Skilled Talker

Posts: 53
thanks chris, that does work. however with some of my longer rules i end up with code like this:

table .reservationTable, .reservationTable td, .reservationTable th, table .sessionTable, .sessionTable td, sessionTable th {
border: 1px solid rgb(133,180,12);
border-collapse: collapse;
}

Not too bad now but if i add more classes and rules it could get very long (for instance 1 more class and one more type of say, 'caption', would result in 6 more combinations). It would be nice if i could just say in css "Make reservationTable = sessionTable in all circumstances" with one line of code. But if you cant do it then thats that i guess.
bez is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to css inheritance, or making a class like another
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12246 seconds with 12 queries