Can CSS detect the number of children an element has?

后端 未结 7 2232
猫巷女王i
猫巷女王i 2020-11-22 00:52

I\'m probably answering my own question, but I\'m extremely curious.

I know that CSS can select individual children of a parent, but is there support to style the ch

7条回答
  •  Happy的楠姐
    2020-11-22 00:57

    No, there is nothing like this in CSS. You can, however, use JavaScript to calculate the number of children and apply styles.

提交回复
热议问题