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

Flexbox, W3schools

Isaac Saettelβ€’ 100

@INS140

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


This challenge was a tough one, but I feel as though I have a close fit to the desired product. I did have some troubles setting all the elements to the correct sizes, it was a lot of trial and error. I have noticed that there is a small issue with the image when viewing the component in a small window on a desktop, but it still looks like it should on my mobile device. I am not sure if this is because of the <picture> element or my media query.

Any feedback regarding these topics or general ways to improve my solution are most certainly welcome!

Community feedback

@MelvinAguilar

Posted

Hi @INS140 πŸ‘‹, good job completing this challenge! πŸŽ‰

I have some suggestions you might consider to improve your code:

  • Update your <picture> element with 600px instead of 400px:
<source media="(min-width: 600px)" srcset="./assets/images/image-product-desktop.jpg">
  • Use min-height: 100vh to the body selector instead of height. This property lets you set a height and let the element grow even more if necessary.
  • For specificity reasons you should work better with classes since they are reusable, and you can leave the ID when you work with Javascript.
  • You could use the <del> tag to display the old price:
<del>
   <span class="sr-only">Old price: </span>$169.99
</del>

Note that I added the <span> with the sr-only class to the del element, this will provide more information about what your old price is about.

The sr-only class is a class that you can add to hide content visually but is only visible to screen-readers.

More information here.

Above all, the project is done wellπŸ‘. I hope those tips will help you! πŸ‘

Good job, and happy coding! 😁

Marked as helpful

0

Isaac Saettelβ€’ 100

@INS140

Posted

@MelvinAguilar Thank you for the great feedback! The advice you gave me fixed that bug I had with the picture element. I'll keep in mind that images need to change at the same interval as media queries. I also read the article you attached and found it very interesting. I hadn't considered the use of a screen reader when designing the pricing section. I plan to pay more attention to details like this in my future projects.

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