我非常好奇(就是这样),看看如何选择元素的所有子元素,除了前两个和最后两个元素。
I’ve a method,但它是讨厌和不可读。必须有一个更清晰的方法,不需要8个伪选择器。@H_403_3@
:not(:nth-child(1)):not(:nth-child(2)):not(:nth-last-child(1)):not(:nth-last-child(2)) { background: purple; }
是的,这太可怕了它字面上选择所有元素:不是第一个或第二个第一个或最后一个。必须有一种使用2作为半变量的方法,而不是在伪选择器上打桩。@H_403_3@
I thought of another one(仍然凌乱):@H_403_3@
:not(:nth-child(-1n+2)):not(:nth-last-child(-1n+2)) { background: purple; }