postcss-plugins icon indicating copy to clipboard operation
postcss-plugins copied to clipboard

CSS `sign()` and `abs()` support?

Open u2re-dev opened this issue 1 year ago • 1 comments

What would you want to propose?

I want to ask support for CSS sign() and abs().

Suggested solution

@support (opacity: abs(-1)) {
  // legal sign()
}

@support not (opacity: abs(-1)) {
  // workaround math
  // such as max(value, calc(0 - value))
}

@support (opacity: sign(0.5)) {
  // legal sign()
}

@support not (opacity: sign(0.5)) {
  // workaround math
  // such as clamp(value / max(abs(value), 0.0001), -1, 1)
}

Additional context

About spec and chrome support:

  • https://www.w3.org/TR/css-values-4/
  • https://issues.chromium.org/issues/40253181

Validations

  • [X] Follow our Code of Conduct
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • [ ] I'm willing to open a PR

u2re-dev avatar Aug 05 '24 14:08 u2re-dev