CSS中的&代表的什么

如源码:

ul{
    margin-bottom: 20px;
    & >li {
        margin-bottom: 0;
    }
  }

& 表示嵌套的上一级
这是sass的语法,代表上一级选择器
解释成CSS代码如下

ul{margin-bottom: 20px;}
ul > li {margin-bottom: 0;}

猜你喜欢

转载自blog.csdn.net/weixin_42861240/article/details/82383709