when to leave space ,when not in CSS?

前端 未结 7 1127
无人共我
无人共我 2021-01-19 19:04

This is ok(without space):

li.highlight{
    background:#FF9900 none repeat scroll 0 0;
}

This will not work(with space):

l         


        
7条回答
  •  终归单人心
    2021-01-19 19:37

    You can think of li .highlight as having an implied * in it. It is equivalent to li *.highlight.

    • li.highlight matches an li element with a class of highlight:
    • .
    • li .highlight with a space matches an element with class highlight which is inside of an li (a descendant): for example, the span in
    • OMG NO WAY!

提交回复
热议问题