:last-child style working, :first-child style not working! Why?

前端 未结 1 2026
独厮守ぢ
独厮守ぢ 2021-01-11 18:07

I\'m creating an inset border effect between paragraphs by using a light border as the border-top on the paragraphs, and a dark border as the border bottom on them.

相关标签:
1条回答
  • 2021-01-11 18:12

    p:first-child does not work because the h1 element is the first child of its corresponding parent element; the p elements are the second, third and fourth child elements. Use p:first-of-type instead to only select the first element of the type p.

    0 讨论(0)
提交回复
热议问题