Responsive Mobile First design using Flex-box and Media Queries
Design comparison
Solution retrospective
Is this a correct use case of bem?
Community feedback
- @correlucasPosted over 2 years ago
๐พHello Oshane, congratulations for your solution!
Answering your question:
By what I know of bem, each element inside a block should have the name of the block in the class, for example your div
card
, the class under it should becard__image
andcard__main
in this case there are no modifers, but if was the case, the class wil lock like thiscard__image--transparent
. Check the guide I let to you below, that explains everything.QUICK GUIDE ABOUT BEM:
https://css-tricks.com/bem-101/
Hope it helps and happy coding!
Marked as helpful1 - @DavidMorgadePosted over 2 years ago
Hello and congrats on finishing the challenge!
Good job choosing BEM right away, you will not regret it!
In this case you need to define different blocks, and each blocks has his own elements / modifiers, for example your full component could be on a main tag with the main class, then you could divide it in to sections one for the image and one for the rest, the first one would be
image
as you did on your project, but for the child image you need to define it with__
since is a directly child for example:image__cologne
. For the other section, try to get more specific class names like,section__heading
,section__description
,section__productName
, when you do a modifier like in the prize, you use the modifier on the different element the discounted prize, can be something likesection__prize
andsection__prize--discounted
.You only write
--
when is a modifier of an element that already exists!.Hope my feedback helped you!
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord