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

Reponsive product previwe card using CSS Grid

@GabrielRuizVarela

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'm yet to learn mobile web development in the course I'm taking. What should I add or change to make it more mobile compatible?

Community feedback

@superschooler

Posted

Hi Gabriel,

I noticed on larger screens there's a large gap between the image and text since you have a fixed height on your image. Something you might do to combat this is use the following css:

.product-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

Even with this, the product doesn't look great on all screen sizes. The easiest solution to this would be to add a max-width to main so it will remain static at the largest visually appealing size. If you wanted to get more advanced, you could use a clamp to grow the text with the screen, but I don't think that's necessary with this project.

Additionally, I'd add a max-width on your mobile product as well around ~425px. Any larger than that and the image dominates until the media break.

Hope this helps!

1

@GabrielRuizVarela

Posted

@superschooler Thanks for your feedback, I completely forgot to check on bigger screens. I implemented your fix with a min-width on desktop and a max-width on mobile, and that seems to fix it.

Cheers.

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