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 (use flexbox, how to use grid?)

@jesuisbienbien

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 have a few questions:

  1. I used flexbox for this challenge but would love to know how to use grid on this.
  2. how to align the component vertically center? I don't know what I'm missing. Any other feedbacks are welcome too. Thank you!

Community feedback

Tiago BW 210

@tiagobw

Posted

Hi Nguyen,

For the Desktop view:

1 To use CSS Grid instead of Flexbox, change the main styles to:

main {
    display: grid;
    grid-template-columns: repeat(3, 20rem);
}

For the mobile view:

1 To use CSS Grid instead of Flexbox, change the main styles to:

main {
    display: grid;
    grid-template-columns: 20rem;
}

2 @Hersonmei's answer is already great.

I hope that helps.

Have a great day. :)

Marked as helpful

0

@jesuisbienbien

Posted

@tiagobw thank you. it's very helpful :D

1
Herson 220

@Hersonmei

Posted

2 - To center your main on the page, you can apply the flex display in the body.

Your body will look like this:

body {
  font-family: "Lexend Deca", sans-serif;
  font-size: 1rem;
  background-color: var(--very-light-gray);
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

Marked as helpful

0

@jesuisbienbien

Posted

@Hersonmei thank you. Not sure why I never thought of that :)

1
xZAYEDx 250

@xZAYEDx

Posted

Good job on completing the challenge. For the attribution div you need to add it inside a footer tag like this 👇🏽 that is after closing the main tag.

<footer>
 <div class="attribution">
    Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. 
    Coded by <a href="https://github.com/jesuisbienbien?tab=repositories">Nguyen Nguyen</a>.
  </div>
</footer>

Just copy paste the above code 👆🏽 in your HTML file I have made it ready for you😁

Marked as helpful

0

@jesuisbienbien

Posted

@xZAYEDx thank you

1

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