Mistake in Calculating Specificity for CSS

前端 未结 5 1488
孤街浪徒
孤街浪徒 2021-01-21 15:52

I\'m trying to experiment with CSS.

Here\'s my code http://codepen.io/anon/pen/mJxrdE

Here\'s the html


 
  

        
5条回答
  •  南方客
    南方客 (楼主)
    2021-01-21 16:23

    You're also applying styles to the children of p#first (.carrot and .spinach). If you'd want everything on the first line to be brown you could to something like this:

    #first,
    #first strong{
        color: brown;
    }
    

    And that's just one way of going about it.

提交回复
热议问题