Subclasses within a table

Discussion in 'CSS' started by eludlow, Jun 29, 2010.

  1. #1
    I have a table that has a class ("usersTable") and then I want to be able to give various cells within that table various classes (eg "options").

    So I have my usersTable nicely defined but I'm struggling with "subclasses" - I would have thought this would work....

    
    table.usersTable {
    	background-color:#e5e5e5;
    }
    .options .usersTable   {
    	border-left: 1px solid black;
    }
    
    Code (markup):
    and then simply
    
    <table class="usersTable">
    	<tr>
    		<td>x</td>
    		<td class="options">this cell SHOULD have a left border</td>
    	</tr>
    </table>
    
    Code (markup):
    but this doesn't work. However:
    
    table.usersTable {
    	background-color:#e5e5e5;
    }
    .options   {
    	border-left: 1px solid black;
    }
    
    Code (markup):
    does.

    How do I make it so that "options" has to be a subclass of usersTable?

    Thanks,
    Ed Ludlow
     
    eludlow, Jun 29, 2010 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    v.1 calls for .userTable when it's descended from the .option td. Do it this way:
    table.usersTable .options {
      border-left: 1px solid black;
      }
    Code (markup):
    cheers,

    gary
     
    kk5st, Jun 29, 2010 IP
  3. eludlow

    eludlow Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Many thanks. Will try this tomorrow when back at my desk.
     
    eludlow, Jun 29, 2010 IP
  4. eludlow

    eludlow Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is all working, thank you :)
     
    eludlow, Jun 30, 2010 IP