Re: [csswg-drafts] [css-mixins-1][css-values-5] A general inheritance syntax (#12990)

It does make the common case more verbose and that may be sufficient reason not to adopt this for mixins.

You could use `container-var` for the host case provided you have no other reason to make the host a named container. Using it for the scoped case correctly is quite complicated:

```css
* {
  --depth: calc(inherit(--depth, 0) + 1);
}

@mixin --apply-color-to-nested(--color) {
  scope(&) {
    :scope {
      --color-to-apply: var(--color);
      --container-name-for-scope: ident(--scope-at var(--depth));
      container-name: var(--container-name-for-scope);
    }
    .nested-1 {
      --container-name-for-nested-1: inherit(--container-name-for-scope);
      .nested-2 {
        color: container-var(inherit(--container-name-for-nested-1), --color-to-apply);
      }
    }
  }
}
```

There is nothing truly necessary about this proposal (unless there is a need for cases like `parent parent`); it would also work to have `inherit()`, `container-var()`, `scope-var()`, and `caller-var()` or whatever is needed for #12987.

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


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

Received on Wednesday, 22 October 2025 11:42:18 UTC