Skip to content

Timonwa/image-set-function

Repository files navigation

Creating responsive images with image-set css function ✍️

This is the code example for my article on Creating responsive images with image-set for Uploadcare. Here is the live demo.

Visit my blog, Timonwa's Notes, for awesome technical content like articles, code snippets, tech goodies, community projects, and more.

Summary

image-set is a CSS function that allows you to make an image responsive, showing variations of the same picture for different screen resolutions when needed. This function is almost the same as the HTML srcset attribute for img tags. We should always make our web images responsive so as to render high-quality images on different devices (known as resolution switching), load the right images on different screen sizes. (known as art direction), and for faster loading of web pages.

Breakdown

  • What are responsive images?
  • Why responsive images?
  • Resolution switching
  • Art direction
  • Speed up loading of web pages
  • Use image-set function
  • How to create responsive images with image-set
    • Syntax
  • How does the image-set function differ from the srcset attribute?
  • Conclusion

Please give this repo a ⭐ if it was helpful to you.