CSS BEM - The What, How, and Why | Block Element Modifier Methodology

  Рет қаралды 15,812

Closure: Web Dev. & More

Closure: Web Dev. & More

Күн бұрын

Пікірлер: 33
@gerar10s
@gerar10s 4 жыл бұрын
What I've been reading so far it say that you can only go down one level with the elements. So, in this case Card__body__content is not acceptable because you went 2 levels down. I'm new to this but every document I've seen about the subject talks about this. Has this changed recently? Thanks
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Hey! You are absolutely correct. BEM specs state that in this case you should skip the parent element and use just Card__content. However, from my experience, maintaining such class names is more annoying than it is useful. This approach won’t reflect the DOM structure in .scss files and make it more difficult to navigate. It’s my bad and I should have mentioned that in the video. Thanks for correcting me!
@gerar10s
@gerar10s 4 жыл бұрын
@@ClosureWebDevMore Great thanks! Like I said, I'm just starting with all this but I have to agree with you. The way you show it here would be my preference. Thanks for the tutorial
@chaitanyashahare2734
@chaitanyashahare2734 Жыл бұрын
The intro was epic XD paused the video to comment
@patricknelson
@patricknelson 2 жыл бұрын
6:00 - I’m with you 100% on BEM for the stated reasons, but curious: Earlier you mentioned ability to Ctrl+F the codebase to find the class. One issue I’ve encountered with using Sass & prefixes is that it gets in the way of this typically. Do you have a process for that or do you just failover to the manual search (i.e. It’s a “Card” so at least you know where to look) or should you just scrap & prefixes all together in order to preserve searchability? 🤔
@mohanadalhiti4300
@mohanadalhiti4300 Жыл бұрын
Thank you 👍
@SuswanaJoel
@SuswanaJoel 10 ай бұрын
Bem
@SuswanaJoel
@SuswanaJoel 10 ай бұрын
Him
@codelightsparkles2403
@codelightsparkles2403 3 жыл бұрын
Thank you for this well explained video. You’re a life saver!!
@dorpeled4768
@dorpeled4768 3 жыл бұрын
Great video, thanks for that.
@yuryitikhonoff9631
@yuryitikhonoff9631 3 жыл бұрын
Content is awesome. Great job. Thank you so much.
@peterballa6060
@peterballa6060 3 жыл бұрын
How a great video thank you! Well explained!
@RubberDuckCoding
@RubberDuckCoding 2 жыл бұрын
VERY NICE!
@DiegoVergaraLoza
@DiegoVergaraLoza 4 жыл бұрын
It makes no sense to me to nest classes using BEM. I think one of the benefits of it is that it reduces the need for nesting to a minimum by using specific class names
@hawkon10
@hawkon10 3 жыл бұрын
Agreed. If anyone else is more interested about this: getbem.com/faq/#css-nested-elements.
@ElixerProgramming
@ElixerProgramming 2 ай бұрын
Just watched a video before this one that warns against this exact thing! That's why it's always good to use multiple sources.
@emanuelYaish
@emanuelYaish 4 жыл бұрын
I very liked the explanation but I have a question, How to implement BEM methodology with other css libraries such as bootstrap or semantic-ui?
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Bootstrap and Semantic are the complete opposite of BEM, so there is no real way to use them together. In BEM, class name defines an element and is unique, while in these two frameworks class is just a way to apply a certain style and can be used on many different elements
@emanuelYaish
@emanuelYaish 4 жыл бұрын
@@ClosureWebDevMore ok thanks very much for the reply, I asked because sometimes you only take some code from bootstrap like the grid and the rest you write on your own .
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
You could try using CSS grids and wrap them in a mix-in if you want to reuse that functionality
@emanuelYaish
@emanuelYaish 4 жыл бұрын
@@ClosureWebDevMore THANKS!! I will try it.
@jamshediqbal7936
@jamshediqbal7936 3 жыл бұрын
If you are already using bootstrap or semantic-ui in your current project, then I won't say anything. But if you don't, then I will prefer not to use these libraries. I'm not against them but in my personal opinion, your own written css is quite enough to make good and challenging design with the help of flexbox, css variables, grid system etc...
@roseuwaezuoke7616
@roseuwaezuoke7616 3 жыл бұрын
Thanks
@dawid_dahl
@dawid_dahl 3 жыл бұрын
Perfect.
@elg281
@elg281 2 жыл бұрын
Hey you're right I didn't learn thank you
@d-landjs
@d-landjs 3 жыл бұрын
GJ!
@MaksymMinenko
@MaksymMinenko 3 жыл бұрын
Card__header__main-image is a wrong way of using BEM. You don't completely understand the methodology.
@johnny2598
@johnny2598 2 жыл бұрын
explain why
@chocofun6612
@chocofun6612 Жыл бұрын
@@johnny2598 see the bem guidelines on it's official site
@RubberDuckCoding
@RubberDuckCoding 2 жыл бұрын
My like button turned black, not blue... I think I pressed it too hard
@korkut31
@korkut31 Жыл бұрын
wrong. what u told is wrong. this is not BEM. there is nothing in BEM like x__y__z. this is wrong.
@yogesh-yadav
@yogesh-yadav Жыл бұрын
6:21 is wrong
@korkut31
@korkut31 9 ай бұрын
u are using bem WRONG.
Getting started with CSS nesting
27:14
Kevin Powell
Рет қаралды 74 М.
BEM 101: How to Make Web Design Organized & Scalable
1:01:37
Kevin Geary
Рет қаралды 22 М.
2 MAGIC SECRETS @denismagicshow @roman_magic
00:32
MasomkaMagic
Рет қаралды 32 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 133 МЛН
Please stop using px for font-size.
15:18
Coder Coder
Рет қаралды 231 М.
10 CSS Pro Tips - Code this, NOT that!
9:39
Fireship
Рет қаралды 2,2 МЛН
Learn CSS BEM (and avoid these common mistakes)
15:36
Dmitry Mayorov
Рет қаралды 8 М.
A look at the CUBE CSS methodology in action
47:09
Kevin Powell
Рет қаралды 104 М.
What is BEM in CSS - Block, Element, Modifier in 6 minutes
6:02
Syal Infotainment
Рет қаралды 18 М.
The differences between CSS and Sass Nesting
12:12
Kevin Powell
Рет қаралды 31 М.
BEM in 6 minutes - CSS Methodology 2024
6:22
Blue Script
Рет қаралды 35 М.
CSS Modules: Why are they great?
12:03
Harry Wolff
Рет қаралды 40 М.
2 MAGIC SECRETS @denismagicshow @roman_magic
00:32
MasomkaMagic
Рет қаралды 32 МЛН