My table has id="mytable"
. I'm trying to apply some CSS on the first and last <th>
only. I tried this but it doesn't work.
#mytable th:first,
#mytable th:last{
//css goes here
}
#mytable th:last-child, #mytable th:first-child {
//css goes here
}
:first-child
and :last-child
attribute selectors are still not supported for IE6
Dec 21, 2010 at 11:10
For CSS
#myTable thead tr th:first,
#myTable thead tr th:last{
/*CSS goes here*/
}
Using Jquery (for last child only):
$("#mytable th:last-child").css({
/*CSS goes here*/
});