选择器命名的问题

来源:8-14 实战项目:设置模块切换按钮交互

人生的起源

2022-02-09

我发现这种 BEM + SMACSS 给选择器命名的方法,在SASS里面不是很好嵌套,老师在用SASS写样式的时候,也是用这种方法命名吗?

写回答

1回答

西门老舅

2022-02-09

这种在sass中也很好操作啊。

举例:

.g-ant {

  display: flex;

}

.g-ant__sider {

  flex-shrink: 0;

  background : #00152a;

  width      : 208px;

  min-height : 100vh;

  position: relative;

  z-index: 3;

}

.g-ant-sider__head {

  flex-shrink: 0;

}

.g-ant-sider__main {

  flex-grow: 1;

  overflow : hidden auto;

}

.g-ant-sider__wrap {

    height        : 100%;

    display       : flex;

    flex-direction: column;

}


//-----------------------------sass

.g-ant{

  display: flex;

  &__sider{

    flex-shrink: 0;

    background : #00152a;

    width      : 208px;

    min-height : 100vh;

    position: relative;

    z-index: 3;

  }

  &-sider{

    &__head{

      flex-shrink: 0;

    }

    &__main{

      flex-grow: 1;

      overflow : hidden auto;

    }

    &__wrap{

      height        : 100%;

      display       : flex;

      flex-direction: column;

    }

  }

}





0
1
人生的起源
了解了
2022-02-09
共1条回复

前端内功修炼 5大主流布局系统进阶

前端内功修炼:5大主流布局系统进阶

758 学习 · 231 问题

查看课程