What would be the best way...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

What would be the best way...

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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 */
}
Post Reply