How to select first and last <th> only?
My table has id="mytable"
. I'm tr开发者_运维问答ying 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
}
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*/
});
精彩评论