+ All Categories
Home > Technology > Introduction to BEM Methodology

Introduction to BEM Methodology

Date post: 19-Feb-2017
Category:
Upload: merixstudio
View: 146 times
Download: 1 times
Share this document with a friend
22
BEM Methodology Jacek Spławski Poznań, January 2016
Transcript
Page 1: Introduction to BEM Methodology

BEM Methodology Jacek Spławski

Poznań, January 2016

Page 2: Introduction to BEM Methodology

We are not designing pages, we are designing systems of components.

— Stephen Hay

Page 3: Introduction to BEM Methodology

Modularity is requirement of maintainable systems.

— Ben Callahan

Page 4: Introduction to BEM Methodology

OOCSS / SMACSS / BEM / Atomic / SUITCSS

Page 5: Introduction to BEM Methodology

BEM is a naming convention for classes in HTML and CSS.

Page 6: Introduction to BEM Methodology

Created by Yandex — one of the leading internet companies in Russia.

Page 7: Introduction to BEM Methodology

Block Element Modifier

Page 8: Introduction to BEM Methodology

Block is standalone entity that is meaningful on its own.

Page 9: Introduction to BEM Methodology

Blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Page 10: Introduction to BEM Methodology

Block names may consist of lowercase Latin letters, digits, and dashes. Individual

words within names are separated by a dash.

.block

Page 11: Introduction to BEM Methodology

Block name should identify block and say what it is responsible for. The block name

replaces IDs.

Page 12: Introduction to BEM Methodology

Element is parts of a block and have no standalone meaning. They are semantically tied to its block.

Page 13: Introduction to BEM Methodology

Element names may consist of Latin letters, digits, dashes and underscores. CSS class is formed as block name plus

two underscores plus element name.

.block__element

Page 14: Introduction to BEM Methodology

Modifier are flags on blocks or elements. Use them to change appearance or

behavior.

Page 15: Introduction to BEM Methodology

Modifier names may consist of Latin letters, digits, dashes and underscores.

CSS class is formed as block’s or element’s name plus two dashes.

.block__element——modifier

Page 16: Introduction to BEM Methodology

DOM Tree → BEM Tree

Page 17: Introduction to BEM Methodology

Sass ♥ BEM

.block { &——modifier {} &__element {} }

=

.block {}

.block——modifier {}

.block__element {}

Page 18: Introduction to BEM Methodology

BEM ? JS

Page 19: Introduction to BEM Methodology

jQuery BEM Helpers jQuery BEM Plugin i-BEM framework by Yandex

Page 20: Introduction to BEM Methodology

no dependencies on other elements reduce cascading problems reduce amount of CSS code create ready blocks library simple and understandable structure in CSS and HTML code Sass loves BEM drop tag names and IDs

Page 21: Introduction to BEM Methodology

long class names which could look’s weird develop the habit to properly name class modular thinking

Page 22: Introduction to BEM Methodology

https://css-tricks.com/bem-101/ http://getbem.com/ https://en.bem.info/https://www.smashingmagazine.com/2012/04/a-new-front-end-methodology-bem/


Recommended