For high-DPI displays, how would you set a background image in CSS that optimizes for resolution without impacting lower resolution displays?

  • background-image: url('[email protected]'), url('image.png');
  • background-image: url('image.png') 2x;
  • background-image: url('image.png') resolution(2dppx);
  • background-image: url('image.png') density(2);
The correct option is background-image: url('image.png') 2x;. This CSS feature uses the 2x suffix to target high-DPI displays without affecting lower resolution displays. It's an effective way to provide optimized images for different screen resolutions, enhancing the user experience on high-DPI screens.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *