BEM naming in CSS

Source: Internet
Author: User
Tags modifiers naming convention

Bem is a very useful, powerful and simple naming convention.

It makes the front-end code easier to read and understand, easier to collaborate, easier to control, more robust and clear and more rigorous, and easier to maintain code.

BEM Naming ideas:

. block{}.block__element{}.block--modifier{}
. Block{}. block__element{}. block--modifier{       } 
Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.com

The naming convention pattern is as follows:

. Block{}. block__element{}. block--modifier{       } 
Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.com

The naming convention pattern is as follows:

. Block{}. block__element{}. block--modifier{       } 
Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.com

Block

Divide everything into a separate module.

A header is Block,header nested search box is block, even an icon a logo is also block,

Blocks can be nested with each other.

Element

All the element under a block, regardless of the level of each other, should spread flat and belong to block.

So BEM up to only b+e+m level three, it is impossible to appear b+e+e+. +e+m Long class name, also requires E cannot have the same name.

Modifier

. Current. Active and other expression states

Make the connection between everything so much tighter that it makes it easier for the team and even you to maintain that the code copyright is owned by the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.combem means blocks, elements (element), modifiers (modifier), a front-end naming methodology presented by the Yandex team. Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.combem means blocks, elements (element), modifiers (modifier), a front-end naming methodology presented by the Yandex team. Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.combem means blocks, elements (element), modifiers (modifier), a front-end naming methodology presented by the Yandex team. Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.combem means blocks, elements (element), modifiers (modifier), a front-end naming methodology presented by the Yandex team. Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.combem means blocks, elements (element), modifiers (modifier), a front-end naming methodology presented by the Yandex team. Copyright belongs to the author.
Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Original: Http://www.w3cplus.com/css/mindbemding-getting-your-head-round-bem-syntax.html? W3cplus.com

BEM naming in CSS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.