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 Responsive Images Image Delivery with Srcset and Sizes Adding Sizes

Doron Geyer
seal-mask
.a{fill-rule:evenodd;}techdegree
Doron Geyer
Full Stack JavaScript Techdegree Student 13,884 Points

Not a Question but additional useful resources that explain sizes more comprehensively. They improved my understanding.

A bit more on srcset and related.

l. https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/

More info on the Sizes attribute

https://css-tricks.com/responsive-images-css/#sizes-in-css

An overview of the topic of responsive images from September 2019 which is perhaps more relevant

https://medium.com/@elad/a-complete-guide-for-responsive-images-b13db359c6c7

Hopefully this will give whoever reads the articles a better understanding of the topic as a whole.

a basic example

sizes="(min-width: 800px) 50vw, 100vw"

Meaning: “If the browser window is wider than 800px, this image is probably going to be displayed about half the size of that. If it’s smaller, it’ll probably be full-width.”

Good Luck and happy coding!

1 Answer