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

Responsive Product Preview Card

@bbuglz81

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I had a good time with this project, but I can't for the life of me get the card centered vertically in desktop. I'd appreciate any pointers! Thank you for taking a look

Community feedback

Josh 1,070

@josh76543210

Posted

Hi @bbuglz81,

Congratulations on completing the challenge!

Here is a quick suggestion for centering your card:

First, give your body a minimum height so that your page takes up the entire viewport and display it using flexbox:

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

Next, you can center the card by simply adding a margin of auto all around main:

main {
  margin: auto;
}

Hope this is helpful for you.

Happy Coding!

Marked as helpful

1

@bbuglz81

Posted

@josh76543210 Thank you SO much! I was bashing my head against that one for too long haha

0
Josh 1,070

@josh76543210

Posted

@bbuglz81 Happy to help!

0
P
K01wfd 690

@K01wfd

Posted

Hi @bbuglz81, 1- One way to center your card vertically is to throw min-height 100vh on body selector then display grid, place-content center and that's it. 2- In addition to normalize.css, a simple css reset would make working with content much easier: *{box-sizing:border-box; margin:0; padding:0;}, this reset will make sure the content width includes will inculde the padding in the total width calculated by the browser, so you don't have to calculate the content width + padding, and this will reset all the padding and margins to 0.

Marked as helpful

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