I have a table in a table and want to format only the first level of <td>s. Surprisingly it doesnt work in Safari and Firefox 3 either. Here is the code: <HTML> <HEAD> <STYLE type="text/css"> table.m td {border:1px solid #F00} table.n > td {border:1px solid #0C0} table.o * > td {border:1px solid #B0B} table.p tr > td {border:1px solid #B0B} table.q > * > td {border:1px solid #00F} table.r > tr > td {border:1px solid #00F} table.s > > td {border:1px solid #0C0} //strange but last idea ;-) </STYLE> </HEAD> <BODY> <TABLE class=m> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=n> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=o> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=p> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=q> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=r> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> <TABLE class=s> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> </BODY> </HTML>
To have something that works: <HTML> <HEAD> <STYLE type="text/css"> table.m td {border:1px solid #F00} table.m td td {border:1px solid #FA0} </STYLE> </HEAD> <BODY> <TABLE class=m> <TR> <TD> <TABLE><TR><TD>innere Tabelle</TD></TR></TABLE> </TD> <TD>Text</TD> </TR> </TABLE> </BODY> </HTML>
HTML automatically "repairs" tables by wrapping bare <tr>s into a <tbody>, which is why your .r selector didn't work. So the selector you want is "table > tbody > tr > td".
Created attachment 111932 [details] Working with table class=a When the higher table has a class its working
Created attachment 111935 [details] Not working with table When the higher table has no class its not working
What when the higher table has no class the problem persists.