Understanding CSS selectors

前端 未结 5 911
一个人的身影
一个人的身影 2020-12-16 07:58

Why is it that the below makes the text red?

#stories li a {color:red}
.default li.expand a {color:green}
li.expand a {color:blue}

         


        
5条回答
  •  天涯浪人
    2020-12-16 08:29

    That seems to be the way it works (sometimes frustratingly), an id selector is more specific than a class.

提交回复
热议问题