[csswg-drafts] [css-sizing] Image aspect ratio revert to original width and height attribute (#5836)

nextend has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-sizing] Image aspect ratio revert to original width and height attribute ==
Width and height attributes for images define the aspect ratio of that image since: https://github.com/whatwg/html/pull/4952

There should be a way in CSS to revert back to this original behavior if some other components redefined the width/height of that image in CSS. 

Here is an example: https://jsfiddle.net/g74a0me2/1/

The following redefines the width and height of the image, so the aspect ratio won't work as the attributes are overridden. 
```img {
  width: 100%;
  height: 100wh;
}```

Then we want to restore the original aspect ratio functionality for a subset of elements, but there is no way. For example with any of the following:
```.my-image {
  width: auto;
  height: auto;
}

.my-image {
  width: initial;
  height: initial;
}

.my-image {
  width: revert;
  height: revert;
}

.my-image {
  width: attr(width px);
  height: attr(height px);
}
```

Related Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1161102#c9

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5836 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 5 January 2021 12:16:59 UTC