How can I target some child elements except where the parent is the first or last child to its parent?
See the comments in my CSS for a better idea of what I mean.
CSS:
/* Always apply */
tr th, tr td
{
text-align: left;
vertical-align: top;
}
/* Apply to all except first <tr> */
tr th, tr td
{
padding-top: 5px;
}
/* Apply to all except last <tr> */
tr th, tr td
{
border-bottom: 1px solid #c4c4c4;
padding-bottom: 5px;
}
HTML:
<table>
<tr>
<th>Born</th>
<td><time datetime="1986-11-05">5<sup>th</sup> November 1986</time></td>
</tr>
<tr>
<th>Gender</th>
<td>Male</td>
</tr>
<tr>
<th>Sports</th>
<td>Football<br />Tennis</td>
</tr>
<tr>
<th>Teams</th>
<td>Liverpool FC<br />Spain FC</td>
</tr>
</table>
Well you have a solution in the questions you linked. Use the
:not()pseudo-class:fiddle
(this won’t work in IE 8 though)
Alternative for IE 7+, if the border styles can change:
or
(but not sure if
+is supported by IE 7)