Skip to content

[css-images-4] Saturate invalid cross-fade values #5333

Open
@0xekez

Description

@0xekez

Per the cross-fade spec:

The percentage represents how much of each image is retained when it is blended with the other images. The percentage must be between 0% and 100% inclusive; any other value is invalid (emphasis mine).

It would be nice to clarify what to do with an invalid value.

Currently both Safari and Chrome handle invalid values by saturating them between 0 and 100 percent. For example, using their older, implemented syntax:

-webkit-cross-fade(
url('https://mdn.mozillademos.org/files/8543/br.png'),
url('https://mdn.mozillademos.org/files/8545/tr.png'),
-50%)

has a computed value of

-webkit-cross-fade(
url('https://mdn.mozillademos.org/files/8543/br.png'),
url('https://mdn.mozillademos.org/files/8545/tr.png'),
0)

We should consider standardizing this behavior or specifying something else if that doesn't seem reasonable.

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