CSS multiple selectors without comma

后端 未结 2 2032
有刺的猬
有刺的猬 2020-12-06 11:55

I am alittle confuse about CSS Selectors, I understand that we can group multiple css selectors with a comma if they share similar attributes, but what about multiple css se

2条回答
  •  佛祖请我去吃肉
    2020-12-06 12:28

    When you use the comma, like

    #menu, .item
    

    you are saying:

    all elements whose id is menu AND all elements whose class is item

    When you nest selectors without the comma, like

    #menu .item
    

    you are saying

    all elements that has class item inside a container whose id is menu

提交回复
热议问题