Skip to content

[css-values] random() function #2826

@bendc

Description

@bendc

Hi,

I see many authors (myself included) rely on JavaScript's Math.random() to generate a number they can then use to randomize colors, positions, animation delays etc. While it's fairly straightforward to do so (notably with custom properties), a potential random function (or keyword) in CSS would make a lot of sense, especially in conjunction with calc() and friends.

AFAICT @tabatkins proposed something similar quite a few years ago, but I don't think we've discussed it recently, and I think we should reevaluate this option now that we have more context and background on how custom properties and mathematical expressions are being used in CSS.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions