选择器命名的问题
来源:8-14 实战项目:设置模块切换按钮交互

人生的起源
2022-02-09
我发现这种 BEM + SMACSS 给选择器命名的方法,在SASS里面不是很好嵌套,老师在用SASS写样式的时候,也是用这种方法命名吗?
1回答
-
这种在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;
}
}
}
012022-02-09
相似问题