@danielmrz-dev
Posted
Hey there! šš½āāļø
Congrats on finishing the challenge! ā
Your project looks awesome!
Here's a tip that might interest you:
š When you have different versions of the same image, consider using the <picture>
tag.
This will help ensure the correct image loads on the user's device, saving bandwidth and boosting performance.
Example:
<picture>
<source media="(min-width: 768px)" srcset="{desktop image path here}">
<img src="{mobile image path here}" alt="{alternative text here}">
</picture>
Hope you find this useful!
Great job overall!
Marked as helpful
@adewalemudasiru
Posted
Thanks for your feedback. I thought of using the picture tag but I wasn't sure about the implementation. With the example code you have provided for the HTML, how do I use/call for the right image in CSS or does the browser automatically recognise the right image for the screen size and set it? @danielmrz-dev
@danielmrz-dev
Posted
@adewalemudasiru
You don't need to call it with CSS (media queries). You just set the two versions inside picture tag and it will automatically switch depending on the screen size.
@adewalemudasiru
Posted
I tried the picture tag element and got it working. It's really useful. Thanks @danielmrz-dev
@danielmrz-dev
Posted
@adewalemudasiru I'm glad I could help! ā