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

Responive Product Preview Card Using CSS Grid and Flexbox

Lexsa 100

@lexsac

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 found spacing decisions and layout the most challenging. For example, I've read that it's best to shy away from declaring font-size in pixels, but saw pixel size in the Figma design file. What is best practice?

I had the same questions around layout - how exact does spacing between items need to be?

Community feedback

@WebDevMirza

Posted

Hello, congratulations on completing this project successfully.

Your query was how to use units in css. Well, there are two types of unit available in css. One is absolute unit and the other one is relative. If you design a responsive layout, you should go for relative unit. Both em and rem are relative unit based on parent and root font size respectively.

  • rem is the best for font-size.
  • bootstrap and tailwind use these relative units, even in margin and padding.

NB: This does not mean that px is useless. Use it when you feel it.

Thank you.

Marked as helpful

0
Hassia Issah 50,810

@Hassiai

Posted

To center .product on the page using grid, replace align-items: center with align-content: center. when centering items in grid, justify-content goes with align-content and justify-items goes with align-items. unlike flexbox which is always justify-content and align-items.

Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

0

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