@tanereren
Posted
Hey, well done on completing the project!
The easiest way to make the img responsive would be to use the <picture>
HTML element - it's a really useful tool that allows you to have multiple images that changes with the viewport width. It saves on writing loads of CSS media-queries for the image!
<picture>
<source media="(min-width:750px)" srcset="images/image-product-mobile.jpg">
<img src="images/image-product-desktop.jpg" alt="">
</picture>
The browser will look for the first <source> element where the media query matches the current viewport width, and then it will display the proper image (specified in the srcset attribute).
The <img> element is required as the last child of the <picture> element, as a fallback option if none of the source tags match
You can find more information: here - w3schools and here - MDN
Let me know how you get on!
Marked as helpful
@maaxg
Posted
@tanereren Hey =)
Thanks for the tip, I've implemented it in the project. I'm going to take a deeper look at it, thanks!