W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

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

From: Roland Soos via GitHub <sysbot+gh@w3.org>
Date: Tue, 05 Jan 2021 12:16:57 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-778945865-1609849016-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:25 UTC