Re: [csswg-drafts] [CSS 2.2] discrepancy in handling auto values for properties in width equality constraint (#11267)

Additionally, the following claim does not appear to hold in either Firefox or Chrome:

>If all of the above have a computed value other than auto, the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the [direction](https://drafts.csswg.org/css2/#propdef-direction) property of the containing block has the value [ltr](https://drafts.csswg.org/css2/#valdef-direction-ltr), the specified value of [margin-right](https://drafts.csswg.org/css2/#propdef-margin-right) is ignored and the value is calculated so as to make the equality true. If the value of direction is [rtl](https://drafts.csswg.org/css2/#valdef-direction-rtl), this happens to [margin-left](https://drafts.csswg.org/css2/#propdef-margin-left) instead.

Scenario:

```html
<!DOCTYPE html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
      #parent {
        width: 200px;
        height: 100px;
        background-color: blue;
      }

      #child {
        background-color: red;
        margin-left: 0;
        border-left-width: 0;
        padding-left: 0;
        width: 250px;
        padding-right: 0;
        border-right-width: 0;
        margin-right: 50px;
      }
    </style>
  </head>
  <body>
    <div id="parent">
      <div id="child">BOX</div>
    </div>
    <script>
      const element = document.getElementById("child");
      const styles = getComputedStyle(element);
      console.log("margin-right:", styles.marginRight); // 50
    </script>
  </body>
</html>
```

**Expected result:**

The used value for `margin-right` should be `-50px`.

**Actual result:**

(Tested on both Chrome and Firefox)

The used value for margin-right is `50px`.

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


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

Received on Sunday, 24 November 2024 12:21:11 UTC