Skip to content

Instantly share code, notes, and snippets.

@ximan
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save ximan/9827642 to your computer and use it in GitHub Desktop.

Select an option

Save ximan/9827642 to your computer and use it in GitHub Desktop.
BEM改进版
既然大家接受不了BEM那种严格模式,那么就尝试一下BEM改进版。
* 不允许有标签没有类名,既所有标签必须有类名
* 按照模块来取名,而不是项目来取名
* 单词或缩写之间,用`-`连接。模块(block)里面都是元素(element),请用`_`连接,且只能连一次,例如`.hot-buy_search-box`。如果有状态(modifier),请在后面用`_`连接,例如`.header_search-box_current`。类名最多只能出现两个`_`。
示例html结构:
<div class="hot-buy">
<ul class="hot-buy_tab-title">
<li class="hot-buy_tab-title-item hot-buy_tab-title_current">TAB1</li>
<li class="hot-buy_tab-title-item">TAB2</li>
</ul>
</div>
@lb1064
Copy link

lb1064 commented Mar 28, 2014

我测试下

你的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment