Monday, April 22, 2013

Using CSS Direct Descendant Selector with Tables

Recently I was attempting to use a  CSS 'direct descendant' selector (>) to set a bottom border on rows in a table. Because there were rows buried deeper in nested tables, I didn't want those to have the border. When I used the following CSS selector, it didn't work.

   table.employee > tr

Turns out, I needed to add a TBODY between the TABLE and TR, even though a TBODY was not showing in the page source because the TBODY is implictly added.


table.employee > tbody > tr
 
 

No comments:

Post a Comment