Skip to content

CSS sign() and abs() support? #1449

Closed
Closed
@u2re-dev

Description

@u2re-dev

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:

Validations

  • Follow our Code of Conduct
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions