Forum Moderators: not2easy

Message Too Old, No Replies

Table CSS

Applying a css class or id to an entire table

         

davemarks

9:19 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



I,m trying to define a class to an entire table, but not all tables.

For instance if i give the table a class of difTable, i then want to be able to use:

#diffTable:TH
#diffTable:TD

I don't want to have to put a class in every td or th

Am i making sense? I can't work out how to do this, would appreciate a point in the right direction... if its possible ofcourse

Thanks

choster

9:37 pm on Sep 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Three quick things-- you say class but have specified ids, the name is difTable in one place and diffTable in another, and you have superfluous colons.

If you are styling table cells and headers inside a table with the class of difTable then your CSS would use

table.difTable th {...}
table.difTable td {...}

with the html <table class="difTable"> . If they are to have the same definition, i.e. if td and th content is to be styled identically, you can put them on one line separated by a comma:

table.difTable th, table.difTable td {...}

Similarly, if the table is unique within the page, you can use an id, i.e. <table id="difTable"> and using "#" instead of "." in the selector.

davemarks

10:24 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



Hi choster

Sorry, reading back through my post, I can tell its time to go to bed... ;)

You did very well to decifer though, and a quick test looks like it works a treat!

Thankyou.

Now time to pop some ibuprofen and hit the bed ;)