CSS - additional rule for specific internal tag

Discussion in 'HTML & Website Design' started by knkk, Aug 4, 2007.

  1. #1
    I want to create a style rule (class) and give it in the <TABLE> tag (e. g. <TABLE CLASS="blah">. But whenever there is a <TD> in the table, I want an additional rule for the td (e. g. give a border to that td, but not to each element in the td, or any other element in the table), without having to write another class and then do <TD CLASS="blah1">. This is to avoid typing multiple <TD CLASS="blah1"> with each cell and therefore to cut down on HTML cource code.

    So my HTML would look like:

    
    <TABLE CLASS="blah">
       <TR>
          <TD>something
          </TD>
       </TR>
       <TR>
          <TD>something
          </TD>
       </TR>
    </TABLE>
    
    Code (markup):
    instead of
    
    <TABLE CLASS="blah">
       <TR>
          <TD CLASS="blah1">something
          </TD>
       </TR>
       <TR>
          <TD CLASS="blah1">something
          </TD>
       </TR>
    </TABLE>
    
    Code (markup):
    Does anyone have any idea how I write the style sheet? I tried this:

    
    .blah,
    .blah a: link,
    .blah a: visited
    { primary rules }
    td.blah: { additional rule for td }
    
    Code (markup):
    but it does not work.

    Thank you very much for your time!
     
    knkk, Aug 4, 2007 IP
  2. Arnica

    Arnica Peon

    Messages:
    320
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would need to use:

    .blah td

    to reference the <td>s in that case.
     
    Arnica, Aug 4, 2007 IP