Can someone please explain to me what calc(.333 * (100vw - 12em))
means in the following line of HTML? And in particular the .333 value; where does that come from?
sizes="(min-width: 36em) calc(.333 * (100vw - 12em)),
100vw"
Taken from http://ericportis.com/posts/2014/srcset-sizes/
A length can be all sorts of things! A length can be absolute (e.g. 99px, 16em) or relative (33.3vw, as in our example). You’ll note that, unlike our example, there are lots of layouts which combine both absolute and relative units. That’s where the surprisingly well-supported calc() function comes in. Let’s say we added a 12em sidebar to our 3-column layout. We’d adjust our sizes attribute like so:
sizes="(min-width: 36em) calc(.333 * (100vw - 12em)),
100vw"
I understand this much:
- (min-width: 36em) = media query
- calc(.333 * (100vw - 12em)) = rendered image size
- 100vw = default rendered image length