I need this to change from the current image file to a desktop image when the screen size reaches a minimum width of 375px . im using tailwind css as my pre processor.
<img src="images/bg-curve-mobile.svg" />
I need this to change from the current image file to a desktop image when the screen size reaches a minimum width of 375px . im using tailwind css as my pre processor.
<img src="images/bg-curve-mobile.svg" />
2
Answers
While this can also be done using JS, here’s a css solution that works. You can replace the url with the file paths of the images in your project.
html:
css:
Resolution switching can be done using the
srcset
andsizes
attributes. (However, this is defeated on displays that have a pixel density of 2.) See the MDN article Responsive images for more info.