Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,972 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.