@MelvinAguilar
Posted
Hi @Vinzz34 ๐, good job completing this challenge, and welcome to the Frontend Mentor Community! ๐
In addition to the previous comments. I have some suggestions you might consider to improve your code:
- In this challenge, you should not use the background property to set the image because this image has semantic meaning. Use the CSS background property if the image is not part of the content.
- You can use a <picture> tag when you need to change an image in different viewports. Using this tag will prevent the browser from loading both images, saving bandwidth and preventing you from utilizing a media query in your CSS file to modify the image.
Example:
<picture>
<source media="(max-width: 50em)" srcset="./images/image-product-mobile.jpg">
<img src="./images/image-product-desktop.jpg" alt="your alt text">
</picture>
- You could use the <del> tag to display the old price:
<del class="wrong">
<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.
- The cart icon is for decoration purposes only, so it can be hidden from screen-readers by adding
aria-hidden="true"
and leaving its alt attribute empty:
<img class="cart-icon" src="./images/icon-cart.svg" alt aria-hidden="true">
I hope those tips will help you! ๐
Good job, and happy coding! ๐
Marked as helpful
@Vinzz34
Posted
@MelvinAguilar thanks a lot will definitely be using these tips for sure!