Мой стол имеет id="mytable".Я пытаюсь применить CSS только для первого и последнего <th>.Я пробовал это, но это не работает.
id="mytable"
<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*/ });