/* At most 3 (3 or less, excluding 0) children */ ul:has(> :nth-child(-n+3):last-child) { outline: 1px solid red; }