Skip to content

cusiousdevops/Responsive-Images

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Responsive-Images

Demo of using a responsive image to load different types of image on different devices and screens using the srcset and sizes attributes

See it in action - https://responsive-images.pages.dev/

Video Tutorial

Video demo:

screen-recording-2022-08-30_20.54.34.mp4

How to add multiple images?

<img
  width="500"
  height="500"
  srcset="
    ./images/doggo-250w.webp   250w,
    ./images/doggo-500w.webp   500w,
    ./images/doggo-750w.webp   750w,
    ./images/doggo-1000w.webp 1000w,
    ./images/doggo-1500w.webp 1500w
  "
  sizes="(min-width: 800px) 500px, (min-width: 500px) calc(50vw - 2px), 100vw"
  alt="a cute doggo eating icecream"
/>

About

How to properly use images with different sizes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 75.0%
  • JavaScript 15.7%
  • Shell 9.3%