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 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,897 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