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

Frontend Mentor - Product preview card component

@kelvin-0

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


  1. I just started implementing relative units of measurement(rem) in my code instead of using px, did I use rem correctly by changing the font size of the HTML element for every screen size change?
  2. Should I use grid or flex for this challenge?
  3. Did I write good code using flexbox?
  4. do I have a good readability website?
  5. on the mobile version, how can I achieve the same design as the given design? Thank you I am new to web design and sorry for my bad English. Any help would be appreciated.

Community feedback

@nzewi

Posted

Nice work completing this challenge Kelvin, you did very well

Here are my suggestions:

1.Your implementation of relative units were okay, however, you did not need to change the font size of the HTML element more than once.

2.Determining which out of flexbox or grid is subjective, any of them will work. Most times, we use grid for layouts and flexbox for smaller components like this.

3.You wrote good flexbox. You can use the max-width property instead of width, this makes your components more responsive. You can use the gap property to space flex-items instead of using margin too.

4.Take a look at the report from Frontend Mentor, you have some HTML issues there.

5.If you make the changes I suggest below, you can achieve the same design.

6.Don't style your HTML elements with an ID as you did on the #preview-card

In your main syling, some properties are redundant. The code below works as well.

main {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(30, 38%, 92%);
    min-height: 100vh;
}

In your preview-card media query, this would work better

@media only screen and (max-width: 375px)
#preview-card {
    flex-direction: column;
    max-width: 90%;
}

In the code below, never leave any content hanging, i.e. you should wrap the 'add to cart' in a tag e.g. `<span>Add to Cart</span>

<button><i class="fa-solid fa-cart-plus"></i> Add to Cart</button>

Keep solving challenges and asking for feedback and you will improve in no time

I hope this helps

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