How to select all children except first and last with CSS selectors

前端 未结 5 1544
花落未央
花落未央 2020-12-24 10:30

How would I select all the children in a table except for the first and last? I\'ve tried this, but it ends up selecting all children that aren\'t first and all children tha

5条回答
  •  情书的邮戳
    2020-12-24 11:10

    Use two :not() selectors combined, thereby referring to elements that match both of them, i.e. to elements that match neither of the selectors used as operands of :not():

    table.programs td:not(:first-child):not(:last-child)
    

提交回复
热议问题