Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

3 Column Preview Card Component

Abaso 90

@originalboss

Desktop design screenshot for the 3-column preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm kind of struggling with BEM methodology for naming but it's a little confusing so can someone recommend an easy way to learn it? Of course any tips would be appreciated.

Community feedback

@george5-star

Posted

Hey @originalboss. Congrats on completing the challenge, and of course there is always room to improve our code, so I think you will find the following helpful:

About your question

I know how confusing it can be when learning something for the first time, especially when it comes to BEM. Actually, BEM stands for Block Element Modifier. Let's consider the following code:

<div class="card card--sedan">
  <img class="card__image" src="" alt=""/>
  <h2 class="card__title">Sedans</h2>
  <p class="card__description">some description here</p>
  <button class="card__btn">learn more<button>
<div>

So the card class is the block, card__image,card__title,card__description,card__btn are the elements because they all depend on the block class and the card--sedan is the modifier, so in your CSS file you could style the background of the card using the modifier. For example: Using the design in this challenge, you could use the card class to style all the common styles and their modifier to style the background color.

.card--sedan {
background-color: orange:
}

.card--suv {
background-color: blue;
}

and so on.

If you want to dive deep into the BEM naming convention, check out their docs -> BEM docs

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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