您将无法一次完成此操作
:nth-child()-您将需要链接至少一个其他此类伪类。例如,的组合
:nth-child()和
:nth-last-child()(该
n+2位装置开始从第二子分别计数向前和向后):
.myTableRow td:nth-child(n+2):nth-last-child(n+2){background-color: #FFFFCC;}或者,不使用公式,只需排除
:first-child和
:last-child:
.myTableRow td:not(:first-child):not(:last-child){background-color: #FFFFCC;}


