css in tables

by "Hilma" <Hilma(at)hilma.freeserve.co.uk>

 Date:  Fri, 21 Jun 2002 09:54:28 +0100
 To:  <hwg-basics(at)hwg.org>
 References:  localhost
  todo: View Thread, Original
Whilst i thought i had a reasonable grasp of style sheets and classes, the
style of my tables cells is causing me grief.
I hope someone can explain....

My (general) problem seems to be that cells do not automatically inherit the
attributes of their "owner" table, or even rows.

The situation i have got is that of
internal links within cells within a table; and to set the colour of those
links (and override my style-sheet general link colour) i need to define it
in ever single link.

My code currently looks like:
----------------------------------------------------------------------------
--------------------------
<!-- index of links -->
  <div class="ProductIndex">
  The following is a list of the our complete ranges, which are detailed
below.

  <table summary="Product Index" class="ProductIndex" border="1"
cellspacing="5" cellpadding="5" >

    <tr >
       <td style='width:33%'><a style='color:linen' href="#PremiumT"
onclick="Toggle('Premium');">Premium</a></td>
       <td style='width:33%'><a style='color:linen' href="#PrestigeT"
onclick="Toggle('Prestige');">Prestige</a></td>
----------------------------------------------------------------------------
--------------------------

Where the link colour within the cell is defined within the href within the
cell, and the cell width in the cell.

But this is totally against what i understand one of  the aims of css to be;
ie reducing code as well as all the other things.
So can anyone please explain how i can say
"For all internal links within cells within the table of
class="ProductIndex" please make the colour linen"
 (which is not one of the 16, i'll fix that with the hex number later!)
And also, fix the cell widths within that class to 33% within a css.

I want to be able to apply styles to tables, or to rows, and have those
styles inherited by the cells within those two "container" tags; but it
doesn';t seem to work that way.
I'm sure correct syntax must be able to do it, but i cannot find an
explanation that i understand.


Also, I know having the  class="ProductIndex" on both the div and the table
looks silly; i can take it out of the table tag with no difference, but i am
trying to understand the inheritance within a table, which appears to be
different to general inheritance rules - or rather, i have trouble
understanding inheritance within a table!

Taking it out of the  table makes no difference, so still my cells need
specific styles added.
And i prefer to apply a style to a table rather than a div, it seems -
"tighter"  and more - specific.

Thanks for any help!

hilma
--x----

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA