Re: [csswg-drafts] [css-grid][css-sizing] Aspect Ratio

aspect-ratio works on all replaced elements whereas intrinsicSize so far only works on HTMLImageElement and HTMLVideoElement. The intention is for it to work well with feature policy 'unsized-media' which deals with problems that cause layout instability (content jumping around on the web page). 

But if aspect-ratio could cover all the cases we need intrinsicSize for (being able to determine the layout size before downloading the image), then I don't think there's a need for intrinsicSize.

So how would aspect-ratio achieve the case of: 
```html
<div style="width: 75vw">
  <img src="my-image.jpg" aspect-ratio="4x3" style="max-width: 100%">
</div>
```
i.e. we want to set the image's width to min(width of container, intrinsic width of image). Is it possible for aspect-ratio to do so before downloading any image data.

Another question would be, how does it work with responsive images, how will the naturalWidth and naturalHeight be updated if an aspect-ratio is specified? 

-- 
GitHub Notification of comment by loonybear
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/333#issuecomment-440001961 using your GitHub account

Received on Monday, 19 November 2018 18:52:57 UTC