Design comparison
Solution retrospective
Hello everyone, my name is João Vitor and I completed another frontend mentor challenge.🔗
- This time I tried to use the BEM nomenclature, it's my first time using it so I don't know if I did it correctly, what do you think?
How can i improve and reduce unnecessary code? Leave your comment. 🙂
Community feedback
- @MelvinAguilarPosted 11 months ago
Hello there 👋. Good job on completing the challenge !
The design is beautiful, very similar to the solution. This requires a lot of effort. Regarding your question:
-
Yes and no, the issue is that BEM (Block Element Modifier) has a specific naming convention, which is the use of hyphens to separate the block, element, and modifier.
The sintaxis for the classes is something like:
block__element--modifier
block
: A standalone component on a webpage.element
: A part of a block, always nested inside a blockmodifier
: A variation or modification of a block or element.
Using
exercise__title__img
suggests two blocks, and it's not following the BEM convention. Instead, you could useexercise__title-img
,exercise__image
ortitle__img
but never something likename1__name2__name3__name4
Additionally, BEM includes modifiers, which are used to represent the different states or variations of a block or element. These modifiers are appended to the block or element with a double underscore. For example,
exercise__title--large
could be a modifier for a larger title.
I hope you find it useful! 😄 Happy coding!
Marked as helpful0 -
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