Comments (4)
You can have multiple elements within a block, for example:
.menu {} .menu__list {} .menu__list-item {} .menu__link {}
Then the html would be:
- link
This is the approach I have taken on a project recently.
from css-guidelines.
Yeah, that's what I said in "The other option would be to give the li some BEM class as well, like .menu__listitem along the class for a which would be .menu_item" but then you are kind of much coupling it with html, aren't you?
On the other hand, for this particular case I could use the utility class, and the other cases I was talking about could probably be dealt with using another elements..
from css-guidelines.
Hey!
If you were to use BEM, you would have:
.menu {}
.menu__item {}
.menu__link {}
but then you are kind of much coupling it with html, aren't you?
The opposite :)
A selector like .menu > li {}
is tightly coupled to the HTML in that you have to use li
s. Using a class means that, for whatever reason, that styling could be applied to anything :)
BEM can seem redundant at times, but itβs a powerful naming convention that, for the most part, works perfectly :)
from css-guidelines.
Thanks!
from css-guidelines.
Related Issues (20)
- Universal selector isn't slow by itself HOT 2
- Suggest include output of SCSS - end of article.
- What's Style trumps? HOT 3
- Spanish translation HOT 2
- Japanese translation HOT 1
- Possible translations? HOT 2
- @media query best practices needed HOT 2
- Typo in repo description HOT 1
- Section links when clicking on a heading HOT 7
- Suggest to include chapter on SASS specific naming conventions HOT 3
- Small grammatical issue. HOT 1
- BEM naming contradictions about reusability
- HTTPS version of site insecure HOT 2
- License?
- Why u no love spaces? HOT 2
- Application hooks (the js-prefix) HOT 1
- Chinese Translation HOT 1
- French translation HOT 1
- About ID specificity
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-guidelines.