N
Nathan Sokalski
I'm not sure if this is the right place to ask this question, but I wasn't
sure where else to go. I have a table made of the following tags:
<table class="myclass">
<tbody>
<tr><td>.</td></tr>
<tr><td>.</td></tr>
<tr><td>.</td></tr>
</tbody>
</table>
The <tbody>.</tbody> section is repeated several times, so I do not want to
individually specify a style attribute or class in all instance, so I
decided to use a stylesheet. Here are the selectors I have:
..myclass{}
..myclass tbody{}
..myclass tbody tr{}
..myclass tbody tr td{}
..myclass tbody tr td *{}
These selectors work fine when you want the same style for all rows in the
tbody, but I want to specify different styles for the first, second, and
third tr tags (and their descendants, the td tag and anything inside the td
tag). I would think the adjacent sibling selector would be the solution for
this, giving me the following selectors:
For the second tr tag:
..myclass tbody tr+tr{}
..myclass tbody tr+tr td{}
..myclass tbody tr+tr td *{}
For the third tr tag:
..myclass tbody tr+tr+tr{}
..myclass tbody tr+tr+tr td{}
..myclass tbody tr+tr+tr td *{}
However, this does not seem to be working. It looks like the selectors I am
using for the second and third tr tags is being ignored, and the ones for
the first tr tag are being used (which is what I would expect if I did not
have the others). Am I doing something wrong? Is there a different selector
I should be using to style the second and third tr tags? Any help would be
appreciated. Thanks.
sure where else to go. I have a table made of the following tags:
<table class="myclass">
<tbody>
<tr><td>.</td></tr>
<tr><td>.</td></tr>
<tr><td>.</td></tr>
</tbody>
</table>
The <tbody>.</tbody> section is repeated several times, so I do not want to
individually specify a style attribute or class in all instance, so I
decided to use a stylesheet. Here are the selectors I have:
..myclass{}
..myclass tbody{}
..myclass tbody tr{}
..myclass tbody tr td{}
..myclass tbody tr td *{}
These selectors work fine when you want the same style for all rows in the
tbody, but I want to specify different styles for the first, second, and
third tr tags (and their descendants, the td tag and anything inside the td
tag). I would think the adjacent sibling selector would be the solution for
this, giving me the following selectors:
For the second tr tag:
..myclass tbody tr+tr{}
..myclass tbody tr+tr td{}
..myclass tbody tr+tr td *{}
For the third tr tag:
..myclass tbody tr+tr+tr{}
..myclass tbody tr+tr+tr td{}
..myclass tbody tr+tr+tr td *{}
However, this does not seem to be working. It looks like the selectors I am
using for the second and third tr tags is being ignored, and the ones for
the first tr tag are being used (which is what I would expect if I did not
have the others). Am I doing something wrong? Is there a different selector
I should be using to style the second and third tr tags? Any help would be
appreciated. Thanks.