2 ms·
Had to look up BEM, this appears to be a good overview: https://css-tricks.com/bem-101/ https://css-tricks.com/bem-101/ [ed: Having now read: http://mrmrs.io/
by e12e 10y ago
Had to look up BEM, this appears to be a good overview:
https://css-tricks.com/bem-101/ https://css-tricks.com/bem-101/
[ed: Having now read: http://mrmrs.io/writing/2016/03/24/scalable-css/ http://mrmrs.io/writing/2016/03/24/scalable-css/ linked above, I can at least see where this idea is coming from. I guess I'm still thinking in documents with semantic mark-up, rather than UI widgets. I'm not entirely convinced throwing out all the cascading bits is the best approach, but I sympathize with that point of view.]
This is madness. Why work so hard to avoid how CSS selectors work? I mean, if you have a menu-structure built around divs, surely it should be enough to say that direct children of the div with class menu, should be considered menu items?
<!DOCTYPE html>
<html>
<body>
<style>
div.menu > div {
background: red;
}
div.menu > div:nth-child(3) {
background: blue;
}
</style>
<div class="menu">
<div>Item one</div>
<div><p>Also<br />an item</p>
</div>
<div>Item #3 and CSSv3
<div>knows (still blue)</div>
it</div>
<div>Item #4 and CSSv3 knows it</div>
</div>
<div>wat</div>
</body>
</html>
- tylerchilds 10y agoI'm with you, those two concepts are mutually exclusive though.