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

@JonathanSamael

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 little difficulty aligning the price, different sizes, even using different class for each one.

Community feedback

Harsh Kumar 1,390

@thisisharsh7

Posted

Hey Jonathan Samael, Good Job ! your solution works fine but there are some improvement which could be made

  1. For aligning the whole content to the center of the screen you should not use body .white-box{position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);} instead try this body{min-height: 100vh; display: flex; align-items: center; justify-content: center;} and for now remove .scratch-price{position: absolute; right: 6.5%; bottom: 22.5%}.
  2. You cannot use width and max-width property at the same time only one is going to work like here in your @media(max-width: 576px){ .white-box{width: 365px; max-width:576px;} }.
  3. Avoid giving every item width and height and if you really want use percentage width or max, min-width and height property.
  4. For aligning the price don't use position property instead use display: flex and then try to align the items it will work fine.

Hope it helps....

Marked as helpful

1

@JonathanSamael

Posted

@thisisharsh7 Thanks! You helped a lot! I'll study more about flex property and make changes.

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