Giter Site home page Giter Site logo

bem-demo's Introduction

bem-demo

  • This is a simple demo of how to use BEM convention for styling.
  • BEM stands for Block, Element, and Modifier. It's a CSS naming convention for writing cleaner and more readable CSS classes. BEM also aims to write independent CSS blocks in order to reuse them later in your project.
  • Tutorial: https://youtu.be/YaAkV--25fg
  • Convention detailed rules :http://getbem.com/naming/

 

Naming

Block

  • Encapsulates a standalone entity that is meaningful on its own.
  • ie: Header, Nav, Form, Footer, Container

Element

  • Parts of a block and have no standalone meaning. Any element is semantically tied to its block.
  • block__elemnet
  • ie: form__input, nav__link

Modifier

  • Flags on blocks or elements. Use them to change appearance, behavior or state.
  • block__elemnet--modifier / block--modifier
  • ie: nav__link--disabled

 

Notes

  • If I have a child inside an element, I can name it as an element. alt text
  • A tag can have more than one class of a block (mix in BEM). alt text
  • Global modifiers cannot be used.
    alt text
  • In the CSS file the modifiers always go after the element to modify, because of the cascade, otherwise it does not work.
    alt text

bem-demo's People

Contributors

diego-ec avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.