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

CSS Flex

Eren 210

@for-dev9

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

@VCarames

Posted

Hey there! 👋 Here are some suggestions to help improve your code:

  • The image’s alt tag description needs to be improved upon to better describe what it is. You will want to assume that you are describing the image to a someone.

More Info:📚

https://www.w3.org/WAI/tutorials/images/

  • This component requires the use of two images 🎑 at different breakpoints. The picture element will facilitate this.

Here is an example of how it works: EXAMPLE

Syntax:

  <picture>
    <source media="(min-width: )" srcset="">
    <img src="" alt="">
  </picture>

More Info:📚

https://www.w3schools.com/html/html_images_picture.asp

  • Currently, the old price (169.99) 🏷 is not being properly announced to screen readers. To fix this, you are going to wrap the the price in a del element and inside it you will add a span element with an sr-only class that will state something like “The previous price was…” and use CSS to make it only visible to screen readers.

More Info:📚

Del Element

If you have any questions or need further clarification, feel free to reach out to me.

Happy Coding!🎄🎁

Marked as helpful

0

Eren 210

@for-dev9

Posted

@vcarames Thanks for your suggestions, I change image when screen size change by CSS (@media )

0

@VCarames

Posted

@for-dev9

I am glad that I was able to help out!

Using the picture element is far more efficient manner and the modern way of doing it.

Keep it up!

1
Eren 210

@for-dev9

Posted

@vcarames I just know picture element today :) Thank you

0

@catherineisonline

Posted

Nice solution 🤩

To improve the code you can add alt attribute to the images and there are several tips you need to follow. If the image is just for decoration you can still write alt attribute but leave it empty, such images don’t need any alt tag but you will need to also add aria-hidden=“true”.

According to MDN “The alt attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility — screen readers read this description out to their users so they know what the image means. Alt text is also displayed on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot.“

IF THIS WAS HELPFUL PLEASE MARK IT AS HELPFUL 🤩

0
Favour 2,140

@Nadine-Green

Posted

** HEY EREN!**

Your solution is an exact replica of the design itself, NICE, but I noticed that the color for the hover effect is wrong, if this was unintentional, the I would suggest just using a darker green as I am not so sure that the color for hover effect was included in the style guide.

IF THIS WAS HELPFUL IN ANYWAY, DON'T HESITATE TO MARK IT AS HELPFUL

HAPPY CODING!

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