2

In my CSS document, I have a selector for my leaderboard table.

table#leaderboard {
     some css
     some css
}

How would I write CSS for the tr, or td for the leaderboard table? Would it be inside the table#leaderboard section?

Thanks,

David

1

If you want to target all the <tr> or <td> children inside the table use:

table#leaderboard tr
{
    /*whitespace combinator*/
    /*all children*/
}

If you want to target only the direct children (in case you have nested tables) use:

table#leaderboard > tr
{
    /*right arrow combinator*/
    /*direct children only*/
}

Edit

Outside the

table#leaderboard {
     some css
     some css
}

that is. You can't nest CSS.

<table>
    <tr>
        <td>Direct td child of tr</td>
    </tr>
    <tr>
        <table>
            <tr>
                <td>Indirect td child of the outer tr</td>
            </tr>
        </table>
    </tr>
</table>
4
  • Thanks! I will do the honors – i_am_david Aug 13 '15 at 16:02
  • What do you mean by direct children..? – i_am_david Aug 13 '15 at 16:27
  • Check the new edit. – ChrisG Aug 13 '15 at 18:51
  • Ahhh I see thanks – i_am_david Aug 14 '15 at 1:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .