1

I was wondering if I could somehow use the srcset attribute in css to (for example) make all images 2x, it usually works like this

<img src="image.jpg" srcset="image.jpg 1x, higher-resolution-image.jpg 2x" >

I wonder if there's a way to use that in css to make all images displayed in 2x Thanks in advance :D

Marwan Sabry
  • 85
  • 3
  • 9
  • Possible duplicate of [Is there a srcset equivalent for css background image](http://stackoverflow.com/questions/26801745/is-there-a-srcset-equivalent-for-css-background-image) – Tamlyn Sep 27 '16 at 21:28

1 Answers1

0

You should find this post useful:

Is there a srcset equivalent for css background image

It mentions using image-set:

background: -webkit-image-set( url('path/to/image') 1x, url('path/to/high-res-image') 2x );

Community
  • 1
  • 1
ShastriH
  • 210
  • 1
  • 3
  • 12
  • You should use a flag to point out a duplicate question, rather than linking to the question and duplicating the answer here. – BoltClock Apr 14 '15 at 17:34
  • Good point, but I just thought as the the question was for "all images" that another solution might be needed, perhaps one that would affect all images by default. – ShastriH Apr 14 '15 at 17:38
  • @ShastriH: didn't even use the "share" link ;-). Btw, `-webkit-image-set` can go anywhere an image is asked for, not only `background`, so it should cover all (Webkit) bases. – Ulrich Schwarz Apr 14 '15 at 18:00