CSS select all child elements except first two and last two May 1, 2023 by Tarik You don’t even need :not(). :nth-child(n+3):nth-last-child(n+3) works fine. Check it out here.