Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

What does srcset and 1x,2x,3x resolution mean? I have some problems with that.

I don't understand What does srcset and 1x,2x,3x resolution mean? I have some problems with that. Can you explain me please?

1 Answer

Steven Parker
Steven Parker
229,744 Points

The srcset attribute allows for a better resolution fit for your images on different devices.

By providing a set of images that have different resolutions, the browser can select the one that best fits the pixel density of the device it will be displayed on.

The "1x, 2x, 3x ... etc." designations indicate the ratio of device pixels to CSS pixels that the image is intended for. The browser uses this number to select which image to use.