Why is a second-child affected by my first-child color property?

后端 未结 4 1503
野性不改
野性不改 2021-01-16 21:47

I was finishing up selectors and testing my knowledge and encountered a problem that makes no sense.

In theory, the code below should color all first children that

4条回答
  •  忘掉有多难
    2021-01-16 22:16

    It happens because the color is inherited from the parent element, try to add this to your CSS to override it:

    li {
        color:initial;
    }
    

提交回复
热议问题