Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信小程序相关资料 #23

Open
ONE-SUNDAY opened this issue Apr 26, 2017 · 0 comments
Open

微信小程序相关资料 #23

ONE-SUNDAY opened this issue Apr 26, 2017 · 0 comments

Comments

@ONE-SUNDAY
Copy link
Owner

ONE-SUNDAY commented Apr 26, 2017

BEM 命名规范

BEM其实是块(block)、元素(element)、修饰符(modifier)的缩写,利用不同的区块,功能以及样式来给元素命名。这三个部分使用__与--连接(这里用两个而不是一个是为了留下用于块儿的命名)。命名约定的模式如下:

.block {}
.block__element {}
.block--modifier {}
  • block 代表了更高级别的抽象或组件
  • block__element 代表 block 的后代,用于形成一个完整的 block 的整体
  • block--modifier 代表 block 的不同状态或不同版本
.block {
    @at-root #{&}__element {}
    @at-root #{&}--modifier {}
}
/* 生成的CSS */
.block {}
.block__element {}
.block--modifier {}

参考资料:https://mrzhang123.github.io/2017/04/05/BEM/

@ONE-SUNDAY ONE-SUNDAY changed the title 小程序相关资料 微信小程序相关资料 Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant