通過閱讀Element-UI源碼來分析學(xué)習(xí)BEM規(guī)范, 使用BEM規(guī)范語義化更加鮮明,閱讀更容易理解,
意思是
塊,
意思是
元素,
意思是
修飾器。
塊與元素之間使用__ 雙下劃線連接,塊或元素與修飾器之間使用-- 雙中劃線連接。
BEM中塊、元素、修飾器的命名如果存在多個(gè)單詞使用- 單中劃線連接
<button class="button">
Normal Button
</button>
<button class="button--state-success">
Success Button
</button>
<div class="footer">
<button class="footer__button">footer button</button>
<button class="footer__button--state-success">footer button</button>
</div>