Don't rely on :last-child to style first/last element, as they may be hidden

Fixes #30