8000 [css-background-4] add background-layers property to set everything but background-color · Issue #8726 · w3c/csswg-drafts · GitHub 8000
[go: up one dir, main page]

Skip to content

[css-background-4] add background-layers property to set everything but background-color #8726

@JaneOri

Description

@JaneOri

spec: https://w3c.github.io/csswg-drafts/css-backgrounds/#the-background

We often run into situations where background-color has already been set for an element or component, and in a separate class we want to also add a background image to it.

In order to do this without overriding the color, we have to use the background-image property specifically.

Then we need to size, position, no-repeat it and that's 3 more longhand properties.

Add two bg images and we're managing parallel arrays in every longhand property above to avoid overriding the background-color set elsewhere.

It gets pretty tedious very quickly.

Fortunately, the spec already defines a <bg-layer> so it may not be a big ask to add background-layers as a shorthand property that defines everything for a background, excluding background-color.

background-layers = <bg-layer># | none

(suggesting plural background-layers even though the longhand bg properties are singular since they predate multiple image layers)

Thank you!

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

      0