-3

Does CSS make possible selecting all the child elements except a first child?

vaultah
  • 44,105
  • 12
  • 114
  • 143
Paul
  • 25,812
  • 38
  • 124
  • 247
  • Maybe duplicate to this question : http://stackoverflow.com/questions/12289853/css-notfirst-child-selector – Simon M. Feb 23 '16 at 08:40
  • Please don't deface your question. – vaultah Feb 23 '16 at 10:15
  • @Paul: because it's against the rules of Stack Overflow. It wasn't a mistake, it's just a duplicate question. *"I won't accept answers here"* - do you seriously expect people to help you in the future? – vaultah Feb 23 '16 at 10:23
  • @Paul: you can ask moderators/high reputation users to delete your question, but it's not necessary to deface it. – vaultah Feb 23 '16 at 10:30
  • @vaultah: I asked them. No reaction. You are right that you deserved your upvote and answer flag. Sorry. But I really do not understand why to keep answers to the duplicate question. A duplicate question should be a kind of redirect. – Paul Feb 23 '16 at 10:33

3 Answers3

3

Yes, using :not(:first-child)

parent child:not(:first-child) { /* style */ }

Example:

div span:not(:first-child) {
    color: red;
}
<div>
    <span>A</span>
    <span>B</span>
    <span>C</span>
</div>
vaultah
  • 44,105
  • 12
  • 114
  • 143
2

Just use the :nth-child selector:

:nth-child(n+2) {}

It will select all children starting with the second one. Or, if all children have the same class (or element tag) you can also use

#parent .class + .class {}
#parent div + div {}
Paul
  • 8,974
  • 3
  • 28
  • 48
1

You can use div:not(:first-child).

janhartmann
  • 14,713
  • 15
  • 82
  • 138