Page 1 of 1

What would be the best way...

Posted: Wed Oct 05, 2005 10:54 am
by someberry
Hi,
What do you think would be the best way to add styles to a table? Before you think, "Just add the class/id" there is a little twist.

I am planning on making a site similar to CSS zen gardens, in which you can use multiple skins to view the pages. The site would be made of course using divs/spans, but for the forum/account setup, I am using tables for the tabular data. With this is mind, how would you go about giving them all styles? Bear in mind I dont really want 50 odd styles just defining widths etc (Im sure people who make a skin or two for it wont be too happy either ;))

Thanks,
Someberry.

Posted: Wed Oct 05, 2005 11:04 am
by feyd
classes and id are the way to go, however you can simply use inheritence (cascading) to do a lot of it

example

Code: Select all

.forumClass table {
  border: 1px solid green;
}

.forumClass table tr {
  /* generic table row stuffs */
}

.forumClass table tr.odd {
  /* "custom" stuff for zebra striping - odd */
}

.forumClass table tr.even {
  /* "custom" stuff for zebra striping - even */
}