Ответ 1
#mytable th:last-child, #mytable th:first-child {
//css goes here
}
Моя таблица имеет id="mytable"
. Я пытаюсь применить CSS только к первой и последней <th>
. Я пробовал это, но он не работает.
#mytable th:first,
#mytable th:last{
//css goes here
}
#mytable th:last-child, #mytable th:first-child {
//css goes here
}
Для CSS
#myTable thead tr th:first,
#myTable thead tr th:last{
/*CSS goes here*/
}
Использование JQuery (только для последнего дочернего):
$("#mytable th:last-child").css({
/*CSS goes here*/
});