applying css for only parent but not to children

前端 未结 4 1724
闹比i
闹比i 2020-12-05 09:58

I have an unordered list like this:

  • list1
    • Sub list1<
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 10:17

    You can use the > operator for that, like this:

    .list > ul > li{
      background:#ccc; 
    }
    

提交回复
热议问题