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

product-preview-card

Mtalafa 350

@Mtalafa

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


Improved solution. Improvement tips are more than welcome.

Community feedback

P
Jacksen 350

@jacksen30

Posted

Hello MTALAFA,

Great work keeping up the momentum and submitting another challenge solution !

I've just taken a quick look I think one of the main issues here is that the body doesn't have a height, so the total body height is only the height of the .container if you have a look in your dev tools and highlight the body element in the DOM / Elements you'll understand.

Here's is a way that you could achieve what you are trying to:

body {
    background-color: hsl(30, 38%, 92%);
    font-family: "Montserrat", sans-serif;
    
    /* ADDED THE BELOW PROPERTIES */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center; 
}
  
  .container {
    display: flex;
    
    /* REMOVED THE BELOW PROPERTIES */
    /* margin-top: 12rem; */
    /* justify-content: center; */
  }

Hopefully this suggestion will help you enough to get unstuck with the centering of the main container, even if this isn't the solution that you decide on implementing.

Marked as helpful

0

Mtalafa 350

@Mtalafa

Posted

@jacksen30 thanks. now it looks like the design

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