Web Ninja 101 | Profile card component with BEM (I'm trying)
Design comparison
Solution retrospective
I'm trying to complete these challenges with the BEM naming strategy but it's hard for me come up with good ones. Any suggestions on how I should name my classes?
Community feedback
- @ApplePieGiraffePosted almost 4 years ago
Hey, Papa Elhadj Abdoulaye NDOYE! 👋
Good work on this challenge! Your solution looks good! 👍
I suggest using CSS background images to add and position the two background SVGs since they are... background images! That'll make your HTML markup a little cleaner. Here's a helpful article on using multiple CSS background images, if you'd like to take a look. 😉
Keep coding (and happy coding, too)! 😁
2@NDOY3M4NPosted almost 4 years ago@ApplePieGiraffe Oh, I didn't know you could use multiple CSS background images. I literally copied your implementation of the background-position, hope you don't mind. Thanks again for this useful tip.
1@ApplePieGiraffePosted almost 4 years ago@NDOY3M4N
Haha, no problem! 😆
Keep learning and having fun!
0 - @JessicaStrachanPosted almost 4 years ago
Naming can be so tricky sometimes! Good effort on the BEM so far, however I did notice one thing:
Lines 27 and 32
card__content__top
andcard__content__bottom
are quite different and going by your css they don't have many styles in common for them to be considered the same element of__content
. I would personally call themcard__main
andcard__footer
. Or if it was a section at the topcard__header
.In the instance that you did have styles that were mostly the same, just a different positioning you would use a BEM class like so:
class="card__content card__content--top"
andclass="card__content card__content--bottom"
and this is where using SASS really helps with using BEM classes because of the nesting:.card *card styles here* &__content *card__content styles here* &--top *Unique styles for the top* &--bottom *Unique styles for the bottom*
2@NDOY3M4NPosted almost 4 years ago@JessicaStrachan thanks for those precious tips. I'll use
card__main
andcard__footer
for now. Following the BEM naming convention is always tricky for me :)0
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