No video

You Probably Need BEM CSS in Your Life (Tutorial)

  Рет қаралды 164,438

DesignCourse

DesignCourse

Күн бұрын

Пікірлер: 365
@DesignCourse
@DesignCourse 4 жыл бұрын
Enjoooy?? Subby subby!
@GammaWraith
@GammaWraith 4 жыл бұрын
I did.. Coursy? Coursy?
@lucianoramirez6525
@lucianoramirez6525 4 жыл бұрын
as always so useful, but I have a question not entirely related. How could one get around having to get the back-end done yourself, and instead just have e.g. an email submission form made with an API? Could that be possible? If so how? Because I actually built a sort of fully-blown html and css project with different urls but my goal for this website is for it to get people submit their email to apply and stuff, but that would require some kind of back-end. Would it not? Hope I explained myself clear enough, sorry if not. Thanks again!
@juraev0056
@juraev0056 4 жыл бұрын
@@lucianoramirez6525 Yes it does require some backend if you want people to sign up to apply for something. If you just want a contact form that sends you a user message from your website, its very easy to do.
@xrishi20
@xrishi20 4 жыл бұрын
It's live sass compiler, not compilation i guess 🤭
@Saaztube
@Saaztube 4 жыл бұрын
Had to subscribe. Thanks.
@yvonniie
@yvonniie 3 жыл бұрын
I want a Part 2 where you go more in depth with a bigger project!
@BenRangel
@BenRangel 4 жыл бұрын
One piece of advice is: don’t forget utility-classes just cause you use BEM! A ”hidden” class makes more senese than having a ton of modifier classes that do the same thing, like ”card-hidden” and ”article-hidden” Only use BEM for unique styles and not common ones. You can combine BEM and utility classes, no need to go 100% in a single direction. doing ”card card-large hidden” is fine
@akashbond862
@akashbond862 4 жыл бұрын
Came here after watching Kevin Powell's video on BEM. There he had said "specificicity", and here Gary says "specifity". Guess Kevin stole Gary's "ci".
@RainOnline
@RainOnline 3 жыл бұрын
lolol
@gabrielsequeira-bacher9049
@gabrielsequeira-bacher9049 3 жыл бұрын
😂
@AverageCho
@AverageCho 3 жыл бұрын
me reading your comment: specifi-kitty...dammit
@UnknownUser-ts1sw
@UnknownUser-ts1sw 3 жыл бұрын
wtf😂
@BenRangel
@BenRangel Жыл бұрын
I've used BEM for many years. Modifiers are great and truly provides a nice way of stating a clear intention that this element has a shared base style and a variant that overrides or adds a few things. But the block__element concept is less useful. It's fine in tiny flat components that you don't change a lot. But in larger things the double underscore often has to be moved deeper down and feels useless. You begin with footer__menu but as that menu gets more and more children you rename it to footer-menu so can have children like footer-menu__user and footer-menu__faq If this renaming happens multiple times, or the dom tree for the footer is quite deep then you end up just forgetting which nodes have the block__element thing and which just use dashes. At which point I usually go "screw it, let's use single dashes all the way" and I never end up regretting it. I still use BEM on small isolated components though.
@georgemallard4120
@georgemallard4120 4 жыл бұрын
I am a CSS newbie. The way he showed BEM using the $ helped me understand the cascade in CSS. Thanks!
@CODINGVENTURE
@CODINGVENTURE 4 жыл бұрын
I'm mad he never noticed that he added a class to the end of the list item tag
@1997matthew
@1997matthew 4 жыл бұрын
It's the Auto Rename Tag plugin that's doing that
@CODINGVENTURE
@CODINGVENTURE 4 жыл бұрын
@@1997matthew I know I'm just mad he didn't notice lol
@local9
@local9 4 жыл бұрын
You got mad at that... I got mad at calling Underscores (_) as Hyphens (-) and Hyphens as Dashes >.
@physx_naraka
@physx_naraka 4 жыл бұрын
I was about to raise my hand and tell him that, thought it was a real-life lecture .
@estoriassurreais3434
@estoriassurreais3434 4 жыл бұрын
@@1997matthew thanks
@crooker2
@crooker2 4 жыл бұрын
Specificity... Pronounced: spes-ih-FISS-city (5 syllables) :) Good video. I don't use BEM currently, but I'm going to play with it.
@rafaellerescapone
@rafaellerescapone 4 жыл бұрын
if i wasnt already using React+Styled Components to deal with such issues, this looks like an amazing system to solve such problems in a practical and DX friendly way
@rosstee
@rosstee 3 жыл бұрын
Thanks for a great intro to BEM. I used to do HTML/CSS years ago and need to pick it back up at work. These days my company uses BEM and SASS so this was perfect and very easy to follow.
@EvaLasta
@EvaLasta 3 жыл бұрын
Man you got such a unique vocabulary haha 1:02 "specifity" 3:14 "complexitness" I think you mean specificity and complexity lol I love your videos btw Im just playing around.
@rand0mtv660
@rand0mtv660 3 жыл бұрын
The second was was him saying "a little bit more complex than this".
@truvc
@truvc 4 жыл бұрын
Styled components are the bomb. Svelte and react have completely made BEM obsolete from my life and I love it
@aspected
@aspected 4 жыл бұрын
I've actually been really enjoying your videos and I've watched quite a few since I found your channel the other day. A lot of stuff I've watched has been beginner-intermediate level but it doesn't feel like I'm missing anything I _must_ already know because you don't speak down to your viewer, which is really nice! Some channels kind of act like they're the best and everyone else sucks, so it's nice to watch videos where I can actually learn and feel like I'm getting somewhere with this.
@alex_chugaev
@alex_chugaev 4 жыл бұрын
I'm so happy Angular has styles isolation mechanism and I don't need to use BEM anymore :D
@Zach2825
@Zach2825 4 жыл бұрын
Vue has that too. It is so convenient
@diablo.the.cheater
@diablo.the.cheater 4 жыл бұрын
@Angelo Stevens overkill is a feature not a bug
@ShadiMuhammad
@ShadiMuhammad 4 жыл бұрын
@@diablo.the.cheater 😂😂
@etmargallo
@etmargallo 3 жыл бұрын
Do you guys mean “scoped”?
@jenninexus
@jenninexus 4 жыл бұрын
This is my new favorite channel :-D Thanks for all the great knowledge
@briankgarland
@briankgarland 4 жыл бұрын
Thanks! I got put onto a project late in development and found all these classes written like this and didn’t know what the heck was going on.
@jennisonb37
@jennisonb37 10 ай бұрын
Thank you for explaining BEM so clearly and succinctly. You got a new sub and I'm looking forward to watching some of the other videos you have.
@n4botz
@n4botz 4 жыл бұрын
I personal use BEM together with OOCSS any projects and it's for me a game changer. Simply clean structured and easy to read CSS. Keep up the good work! Regards from germany!
@chrisandrew_tv
@chrisandrew_tv 4 жыл бұрын
BEMs weakness, if there’s one to be extracted from these comments, is its name. Blocks, elements; most of these people know what those are and that can make it confusing when there are more than 2 nest levels. What I take away from this is that it’s definitely useful if used thoughtfully, when considering the first slides: What blocks on are project are similar in HTML structure but unique in content nature or styling? Card, content, list, these terms are general but if I imagine a blog post preview, album preview, news article preview or rental listing, I can see how BEM would be beneficial. Thank you.
@nikolozmacharashvili1212
@nikolozmacharashvili1212 Жыл бұрын
great job with the slides... best slides I have ever seen
@Vittokm
@Vittokm 10 ай бұрын
Very very good! was trying to understand this before but only now I understand :)
@flowerofash4439
@flowerofash4439 2 жыл бұрын
nice method on writing css, scss + bem probably the best way to go for large project
@riiad
@riiad 4 жыл бұрын
Here's the only reason I liked this video : He directly, simply, clearly explains what is BEM. That it's a methodology and what's its purpose. It seems all the other guys just start talking and talking as if it's gonna be a philosophical talk. And you don't even have a clue of what BEM is.
@devKazuto
@devKazuto 4 жыл бұрын
I'm not a fan of BEM. I prefer using utility classes instead of --modifier. Most IDE don't have a problem selecting "card-header" on double click, but will struggle with "card__header". Having an arbitrary long class name will also increase file size. We're removing line breaks and spaces on minification, but 30 letters long classes are fine.
@BenRangel
@BenRangel 4 жыл бұрын
Kazu: which IDE? i thought most had a hotkey to select by free text search. I use vscode and I use cmd+d to select any string by free text search
@BenRangel
@BenRangel 4 жыл бұрын
What do you mean by arbitrarily long? In BEM the idea is you can only have a single level: card__header is ok but card__header__title or card__header__title__icon is banned
@devKazuto
@devKazuto 4 жыл бұрын
@@BenRangel I'm talking about double click text selecting, not hotkey. Some don't see cohesion of a string like "abc--xyz". Having class="button button--state-success" creates a larger filesize in HTML than class="button success". In CSS it's the same. .button-state-success are more characters than .button.success and therefor results in a larger filesize.
@kootahaitoo
@kootahaitoo 4 жыл бұрын
@Angelo Stevens yeah file size is like the last reason i would worry when dealing with BEM and CSS
@alexsmith-rs6zq
@alexsmith-rs6zq 3 жыл бұрын
Why not both? I’ve recently started using a combination of utility classes for shared styles and BEM for unique styling. It seams to be working well so far.
@JPierro
@JPierro 4 жыл бұрын
You are really good at explaining these things. You rock.
@rogaldorn7016
@rogaldorn7016 4 жыл бұрын
Wow, one of the best practices! I love to use it with SASS or LESS! It makes writing your code much easier. Hovewer, BEM classes can be really long sometimes (class="card__heading card__heading--available main__card")
@ead5590
@ead5590 4 жыл бұрын
So true about it being long.. Sometimes I myself would forget what was the modifier I used.. 🤣 Then I'd have to browse through the entire HTML file looking for what I need to work on..
@rogaldorn7016
@rogaldorn7016 4 жыл бұрын
@@ead5590 or sometimes you can have similar classes 🤣 Especially, when your project as big as f...
@ead5590
@ead5590 4 жыл бұрын
@@rogaldorn7016 Definitely. That's very possible. And that is probably one of the reasons why we use stuff like BEM so that we don't have such issues. Then again, it's a matter of preference. If someone would like to use methodologies such as BEM or not, it's clearly up to the Developer.
@BenRangel
@BenRangel 4 жыл бұрын
Why would you have one element be both "main__card" and "card__heading"? That doesn't make sense. Either it's a card or a heading for a card. Not both at the same time.
@rogaldorn7016
@rogaldorn7016 4 жыл бұрын
@@BenRangel yah, my bad. It should sound like "card main__card main__card--active"
@doggycat
@doggycat 4 жыл бұрын
Why are the elements considered as elements of the card rather than elements of the "card__list"? Are they not elements immediately tied to the list?
@thmscz7707
@thmscz7707 4 жыл бұрын
When using the bem metodology properly, you shoul always refer to the one main block element and go only one level deep.. I personally would rather use here a class like card__list-element. Hope it makes sense
@doggycat
@doggycat 4 жыл бұрын
@@thmscz7707 Ah that makes sense. Thanks for explaining!
@ufufu001
@ufufu001 3 жыл бұрын
This is *perfect* ! I'm gonna be using it even if the project is small. My CSS naming is a mess and this makes it super organized and coherent. THANK YOU
@howiewang4238
@howiewang4238 3 жыл бұрын
Thank you for this tutorial. In the beginning, why do we need two underscores for Class name instead of one underscore, which is simpler and more efficient?
@souravsinha5330
@souravsinha5330 3 жыл бұрын
Thanks a lot sir. Really helped me a lot to understand it from scratch. I'm very much new to this SCSS and BEM concept
@lennart5845
@lennart5845 4 жыл бұрын
I’ve been using it just because I saw that JetBrains has it on the webpage. Now I see why I’m doing it
@notkamui9749
@notkamui9749 4 жыл бұрын
I like the fact that you follow JetBrains :)
@AndiRadyKurniawan
@AndiRadyKurniawan 4 жыл бұрын
Why is that? What's the benefit?
@lennart5845
@lennart5845 4 жыл бұрын
Andi Rady Kurniawan if you’re using scss, which will definitely help you a lot, this Bem makes it easier. You can type .menu and in scss the „&“ character selects it again but you can add something. So for example if you have a list in your menu which has the class „menu__list“ you can just type in the menu css: &__list (.menu__list). And that with several items. It just helps you a lot and organizes everything
@parthkumarchaudhary
@parthkumarchaudhary 4 жыл бұрын
Tutorial on time. Thank you Gery Teacher. :)
@Gigusx
@Gigusx 4 жыл бұрын
I got into TailwindCSS before getting interested in BEM, so I never really ended up needing it. A useful video nonetheless for a quick overview!
@Gigusx
@Gigusx 4 жыл бұрын
@Library Content Yeah, me as well! The nesting of SASS makes it all look very clean and easy to modify.
@Arttyor
@Arttyor 4 жыл бұрын
Tailwind is framework tho, this is just methology
@Gigusx
@Gigusx 4 жыл бұрын
@@Arttyor That's right, but it removes the necessity for using a naming methodology, at least when you follow the similar process that Adam Wathan (Tailwind's author) does.
@ihajo
@ihajo 4 жыл бұрын
Great video as usual.. I love these fast short and on point.. keepem coming
@USONOFAV
@USONOFAV 4 жыл бұрын
Been like doing this, but without those double underscores and double dash for modifiers. However, thank you for showing this.
@danteelegante4601
@danteelegante4601 3 жыл бұрын
Omg you get a thumbs up on this video my friend especially after you said "You better not leave". 😂 That moment definitely made me laugh so hard but also made me want to stick around to the end. Thanks for having an awesome sense of humor while teaching. 💜
@techtipsuk
@techtipsuk 4 жыл бұрын
It’s not so much semantics, it’s modularity of it that’s important.
@andreppg
@andreppg 2 жыл бұрын
Great tutorial ! Good speed, clean and straightforward to the point. Thanks.
@GamingTSH
@GamingTSH 2 жыл бұрын
🙏❤️kzfaq.info/get/bejne/otN5qrx9q7--aYk.html❤️🙏
@JohnVenters
@JohnVenters 4 жыл бұрын
Sorry to be that guy, but it's "specificity"
@DesignCourse
@DesignCourse 4 жыл бұрын
I can't even say that. And I want to punch whoever came up with the term.
@JohnVenters
@JohnVenters 4 жыл бұрын
@@DesignCourse Haha, no worries, mate! Great tutorial regardless. Thanks for taking the time to make it for us!
@dertuman
@dertuman 4 жыл бұрын
Haha was just about to post this
@svendbentjensen5512
@svendbentjensen5512 4 жыл бұрын
Actually it's speficitify, everyone knows that
@harrypehkonen
@harrypehkonen 4 жыл бұрын
@@DesignCourse "Specificness" -- much easier to say. It's even in the dictionary! Apparently it has a slightly different meaning, though... although *I* think it's more accurate (i.e. more specific to what we are using it for) ;D
@mrsingh5351
@mrsingh5351 4 жыл бұрын
So much style in your videos, it's actually delicious!
@karldtrumpeter
@karldtrumpeter 3 жыл бұрын
Couldn't be more explicit. Thank you!
@mirza4477
@mirza4477 3 жыл бұрын
Awesome, simple explanation in less than 20 minutes!
@sahilgarg1924
@sahilgarg1924 3 жыл бұрын
It was great! Improved my method of coding CSS!
@garethBarry_dev
@garethBarry_dev 4 жыл бұрын
Great video, enjoyed the insight. Will try this out on our next project, cheers!
@leonbenjamin7891
@leonbenjamin7891 3 жыл бұрын
Excellent video to understand BEM methodology. Thanks!
@AstroSirrus
@AstroSirrus 3 жыл бұрын
Bem Bem... What a Bem Bem! 💎 Thanks for this great tutorial! 🤗🤗🤗
@andresfrr100
@andresfrr100 3 жыл бұрын
Thanks! A really good example of using BEM.
@acidspark
@acidspark 4 жыл бұрын
11:40 "__" is underscore underscore, double underscore or dunder, not hyphen hyphen you did it repeatedly, at some point everything just became hyphen hyphen.
@local9
@local9 4 жыл бұрын
It ground my gears to much.
@mariodakhil7805
@mariodakhil7805 4 жыл бұрын
this is so helpful , i understand them here better than my teacher
@ujjawalchatterjee
@ujjawalchatterjee 4 жыл бұрын
Why can't we consider the list as an individual block and the items as it's element?
@sashabeep
@sashabeep 4 жыл бұрын
You can put the block into another block - it's allowed by convention
@ujjawalchatterjee
@ujjawalchatterjee 4 жыл бұрын
But, in this case, what is it? Block or element?
@fuzzypumpkin7743
@fuzzypumpkin7743 4 жыл бұрын
BEM in SASS + React components. The organization flows beautifully.
@zentekvideogames3589
@zentekvideogames3589 3 жыл бұрын
12:03 Was it necessary to add class="card__item" inside the closing tags as well? Or was it a typo?
@xentric313
@xentric313 3 жыл бұрын
Just a typo ^^
@narudesigns
@narudesigns 3 жыл бұрын
Definitely an error
@dasunanushka8774
@dasunanushka8774 4 жыл бұрын
Best explanation with an example. Thanks.
@AdyB2008
@AdyB2008 2 жыл бұрын
Great easy to understand video. Thank you!
@sunflair-wa
@sunflair-wa 2 жыл бұрын
Thank you so much. I feel like I have been given the secret handshake to the club :)
@GamingTSH
@GamingTSH 2 жыл бұрын
🙏❤️kzfaq.info/get/bejne/otN5qrx9q7--aYk.html❤️🙏
@ead5590
@ead5590 4 жыл бұрын
Yesssss! Finally somebody who I trust covering a topic that seemed to me like a mystery.. I mean seriously.. When I was learning CSS, all that mattered in naming classes was something that was easy for me as a developer.. And then came along BEM, SMACSS, OOCSS and who knows what.. Like wtf.. 😵 Thanks for talking about BEM Gary.. Now how about SMACSS, OOCSS.. 😁
@sugiono2801
@sugiono2801 4 жыл бұрын
how do you know that name? SMACSS, OOCSS or maybe something thats never exists but actually exists?
@ead5590
@ead5590 4 жыл бұрын
@@sugiono2801 Sup man! Well I'd taken a Udemy course by Jonas Schmedtmann named 'Advanced CSS and SASS' course. Within that he mentions of these methodologies for naming the various classes. But he uses the BEM method during the course. It would be worth noting these methods because recently when I was browsing through job postings on LinkedIn, there are postings where they ask you to have a fair amount of knowledge about a specific method such as BEM.
@user-gs3pt1uf1g
@user-gs3pt1uf1g 2 жыл бұрын
Coming from a big project, one important lesson learnt: don't abuse Sass/SCSS, keep it to bare minimum. Reason? Trying to resolve a high priority production defect with a huge SPA codebase, it doesn't help to have .block { ...; &__element{... &--modifier{...}} rulsets: it very hard to find the original rule definition in source code, since in the browser you'll see generated version. The lesson learned, in order to be able to quickly find a rule, write entire selector by hand, don't leave it up to SCSS preprocessor. One thing is to write confusing Sass code to impress junior female developers on your team, and another thing to debug prod issue under pressure and a lot of stress. KISS.
@GamingTSH
@GamingTSH 2 жыл бұрын
🙏❤️kzfaq.info/get/bejne/otN5qrx9q7--aYk.html❤️🙏
@vito-mohagheghian
@vito-mohagheghian Жыл бұрын
the best BEM tutorial
@0neonited463
@0neonited463 4 жыл бұрын
Been using BEM method for over 2 month now... But thanks for reminding how it is..
@babayaga5848
@babayaga5848 4 жыл бұрын
great stuff simon, can you please make a video that explain how to configure php for vsCode, so it can auto complete and other things like the atom built-in feature
@klingonac79
@klingonac79 4 жыл бұрын
Best BEM explanation so far
@sojibhasan1380
@sojibhasan1380 3 жыл бұрын
This video is very helpful especially for me.
@deniskazakov4584
@deniskazakov4584 4 жыл бұрын
Card__content accidentally is not a block?
@nurullokhuvaidullaev9684
@nurullokhuvaidullaev9684 4 жыл бұрын
Awesome job! Thanks, Gary🙌🏿
@alamesawikanningkaton5028
@alamesawikanningkaton5028 2 жыл бұрын
That was clear... but a little bit confusing if we want to use isolated component or block to another block. We can not override style from unrelated block. for example, we want to use .btn block inside .card block. Let say that the button inside .card block have different style. So how we deal with it?
@JensAndersenGuitarist
@JensAndersenGuitarist 2 жыл бұрын
It is Spe-ci-fi-ci-ty ;-) And why arent you using semantic elements in HTML? Like a section or an article for the card? It is supposed to be an element that can stand alone and therefore it should be an article or a section for each card? I know that there is not a title/heading in this example, but anyways? And why is the picture/img not a part of the content element?
@TineruHarlem
@TineruHarlem 2 жыл бұрын
Thank you for a good explanation! This video helped a lot!
@dilinirajapaksha
@dilinirajapaksha 2 жыл бұрын
Very helpful, great tutorial. Thank you!!!
@coolworx
@coolworx Жыл бұрын
What's the point of doubling up on the underscores and the hyphens? Wouldn't card_button-active tell you the same information (what it's for) as card__button--active?
@gajendra1987
@gajendra1987 3 жыл бұрын
Good content, liked and subscribed. All the best!!
@afique8932
@afique8932 4 жыл бұрын
Very good explanation. Thank you!
@DavidJonathan10
@DavidJonathan10 3 жыл бұрын
Thanks for all your great content always.
@TsunaSawada26
@TsunaSawada26 4 жыл бұрын
I once used it but never again. The problem is that you class names become longer and longer and can be simplified with .card.button.active for example.
@edwingarcia5043
@edwingarcia5043 4 жыл бұрын
specificity graph becomes crazy with that
@olasoderlind5685
@olasoderlind5685 4 жыл бұрын
Why not .card ,, .card > img ,, .card > h2 ,, .card > p ,, .card > a .. ? i anser my own Q --> becose, card__* is unic for sepcial but the "card > img" is for overall styling
@sashabeep
@sashabeep 4 жыл бұрын
When you will need additional style for particular image .card>img will not allow you to do that due to specifity codepen.io/sashabeep/pen/JjdGWJw
@simpleprogramming4671
@simpleprogramming4671 4 жыл бұрын
Design Course thank you so much for your amazing tutorials. Your Videos are really unique. I have a question, when a block gets very big(when I start a big project it gets really confusing for me how to break it to smaller blocks and elements. does anybody have any suggestions? Thank you all in advance :)
@ChrisAthanas
@ChrisAthanas 3 жыл бұрын
Solid clear explanation
@PoetikSage
@PoetikSage 2 жыл бұрын
I don't care if I'm doing large project or small, I always use BEM. (that's different thing I don't get large projects)
@amirfayazi562
@amirfayazi562 6 ай бұрын
Thanks for such a helpful video
@sanketmane5838
@sanketmane5838 2 жыл бұрын
Thank you so much for this tutorial...
@adventure-007
@adventure-007 4 жыл бұрын
Done that loooong ago. Best decision!
@kory3762
@kory3762 4 жыл бұрын
Great Tutorial DesignCourse!!!
@DavidOtto82
@DavidOtto82 3 жыл бұрын
If you dont know how to use the C in CSS, BEM really shines ;D No, srsly: Dont use BEM, unless you are writing plugins
@craigdanielmaceacher
@craigdanielmaceacher 4 жыл бұрын
@10:30 isn't the semantically tied to the card__content div just above it? It's nested inside that div so shouldn't it be card__content__ul? This is confusing
@CabbageYe
@CabbageYe 4 жыл бұрын
It's very confusing, I don't like BEM personally
@danielmancera9867
@danielmancera9867 3 жыл бұрын
but the UL could not be considered as a block itself? card-list and the the items, card-list__item?
@IcedCupcakes
@IcedCupcakes 8 ай бұрын
"specifity. I can never say it right. SPECIFITY! there we go!" DEAD xD great video though!!
@yashkadam278
@yashkadam278 4 жыл бұрын
Thanks for making a video on this topic.....
@ilyasseisov7204
@ilyasseisov7204 3 жыл бұрын
Thank you Gary!
@zayarlyn
@zayarlyn 2 жыл бұрын
gonna follow that convention
@eritert
@eritert 4 жыл бұрын
Why not just nest in sass and leave out the duplicate text in classes?
@soldadopreciso
@soldadopreciso 3 жыл бұрын
Thanks pal, what about general approach.
@BenRangel
@BenRangel 4 жыл бұрын
I dislike classname concatenation like "&__item". I would write the full classname; "card__item". Many new Sass-users fall in love with the idea of concatenating all classnames. My team used to do that but we decided it makes your code messier in the long run. A) You can't copy-paste a full classname from your html and search for it in your codebase. You always have to remember that only one part of the classname is searchable. B) You create a lot of nesting in your code. So when you find "&__item" you always have to look up to see what the full classname actually is. People will argue that "the advantage is that if you rename 'card' to something else, you just have to change it in one place in your sass file" But I'd argue this is NOT a major concern. I don't rename stuff that often, and when I do - search-and-replace only takes seconds. I do however search through and read my code all the time. So anything that increases readability is a more worthwhile investment.
@Arttyor
@Arttyor 4 жыл бұрын
I agree, plus they still need to replace class name in HTML, so will end up using searc-and-replace anyway. Which css methology do you prefer?
@BenRangel
@BenRangel 4 жыл бұрын
narkar: I like BEM as long as you’re not being needlessly strict about it and try to shoehorn it into every situation. We use utility-classes (like ”hidden”) in instances where the same behavior is reused often. I think it’s insane to use BEM classes for common features like that (for example using card-hidden and article-hidden if they both just set display:none) mostly use BEM mostly elements with many children. If an elem just has 1-2 children and no deep nesting I avoid BEM. ”article p” is fine. We use css preprocessor features where we think its most necessary. We avoid class name concatenation. But We use variables in cases where it make it more obvious how stuff relates to each other, especially for things like z-indexes. I hate seeing ”z-index: 95” , cause writing ”z:index: $popup-z-index + 1” is so much more understandable. We use variables to make sure we use standard measurements as often as possible like $padding-mobile and $padding-desktop but if something needs tweaking because of the font used we’re fine with doing an excepting and hard coding a pixel distance. We don’t use a grid-system for stuff like columns as we do a lot of different layouts for different pages and I think it’s much faster to write custom css for a rare case where we need 5 columns than to use bootstrap’s grid and hack some kind of 5-column-class. (But if we were building a more simple/cheap site that didn’t have time to do custom layouts we’d probably use more gris-systems)
@Arttyor
@Arttyor 4 жыл бұрын
@@BenRangel That is neat tip for z-index. Thanks. I like using display: grid for it's autoplacement. I dont use bootstrap's grid at all.
@EpicphoneGamer
@EpicphoneGamer 2 жыл бұрын
Important question. What is that green guitar in the background? Are these EMG pickups?
@grapes639
@grapes639 4 жыл бұрын
I use BEM, but one of the things I find the most annoying with it is how absurdly long some class names can get. Especially if you want to toggle a class. Like in your instance if you had a "card__button" and then you wanted to add the "active" class, the two classes alone would be long "card__button card__button--active" now imagine that and pairing it with more classes like for example col-12 col-lg-4 etc. I think the classes just end up looking hella messy after a while.
@cswithabdullah2638
@cswithabdullah2638 3 жыл бұрын
My underscore is not displaying. When I type underscore it is not displayed instead multiple items get selected. Anyone has solution?
@piorun1316
@piorun1316 4 жыл бұрын
I heard a lot about BEM and then I discovered TailwindCSS which is mega cool. Worth checking out :)
@firespittnkitten
@firespittnkitten 4 жыл бұрын
I don't see why this is necessary. In your card example, you could use the class name "picture" and target that via CSS with .card > .picture. BEM is just a solution in search of a problem.
@simonkalu
@simonkalu 4 жыл бұрын
Awesome! Thanks for your time
@davidnagy1046
@davidnagy1046 4 жыл бұрын
thank you for the video! will you cover CSS-in-JS sometime soon?
@sumitwadhwa8823
@sumitwadhwa8823 4 жыл бұрын
shouldn't card__item be card__list__item..? it's little confusing when it nested
@BenRangel
@BenRangel 4 жыл бұрын
One minor annoyance I have with BEM is that you often get into refactoring discussions in your team as your DOM depth grows. You start out with "card" and "card__header". Later you might need to add a title and an image to the header. But BEM (wisely) forbids nested element-classes like "card__header__title". So then you get into the refactoring debate. Do we do ".card__header .title" or ".card header__title"? And then you might get into asking yourself why you're even using BEM. You could just do ".card .header .title"
Learn Sass in this Free Crash Course - Give your CSS Superpowers!
46:26
Bad at Picking COLORS?  Let's fix that - RAPID Color Scheming
17:04
DesignCourse
Рет қаралды 363 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 14 МЛН
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 20 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 31 МЛН
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Бискас
Рет қаралды 6 МЛН
Organizing CSS with OOCSS, SMACSS, and BEM - Matt Stauffer
37:55
Gainesville Front-end Developers Meetup
Рет қаралды 77 М.
The Magic of CSS Grid AUTO-FIT vs AUTO-FILL
11:25
DesignCourse
Рет қаралды 178 М.
Awesome UI Interactions with the CSS Clip Path Property
16:15
DesignCourse
Рет қаралды 337 М.
STOP The CSS Grid Confusion - 2 Ways to GRID!
26:09
DesignCourse
Рет қаралды 178 М.
Flexbox design patterns you can use in your projects
15:33
Kevin Powell
Рет қаралды 439 М.
Learn CSS BEM (and avoid these common mistakes)
15:36
Dmitry Mayorov
Рет қаралды 6 М.
БЭМ методология за 15 минут с практикой на реальном макете!
14:49
HTML Practice - фриланс, web-разработка, нейросети
Рет қаралды 5 М.
CSS BEM - The What, How, and Why | Block Element Modifier Methodology
7:18
Closure: Web Dev. & More
Рет қаралды 15 М.
Sass and BEM for beginners
3:45:10
Coder Coder
Рет қаралды 246 М.
The differences between CSS and Sass Nesting
12:12
Kevin Powell
Рет қаралды 29 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 14 МЛН