Skip to content

[css-backgrounds-3] Can background syntax be made more future-proof? #12849

@cdoublev

Description

@cdoublev

I hope this editorial change can be applied to <final-bg-layer>:

background = <bg-layer>#? , <final-bg-layer>

- <final-bg-layer> = <bg-image> || <bg-position> [/ <bg-size>]? || <repeat-style> || <attachment> || <visual-box> || <visual-box> || <'background-color'>`
+ <final-bg-layer> = <'background-image'> || <'background-position'> [/ <'background-size'>]? || <'background-repeat'> || <'background-attachment'> || <'background-origin'> || <'background-clip'> || <'background-color'>`

Basically the same change (omitted for brevity) would apply to <bg-layer>.

Why?

(1) background-clip is defined with <bg-clip>, which produces <visual-box> | [ border-area || text ], but <*-bg-layer> only accepts <visual-box>. By using property value ranges (<'background-*>) instead of specific types (<bg-*>), the background syntax can be decoupled from longhand or type definitions in specific level(s) of the spec.

(2) CSS Backgrounds editors could extend background-repeat without changing <repeat-style> (which is used in mask syntax) or creating <bg-repeat>. The same applies to background-attachment and <attachment>, which is however not used elsewhere.

(3) <final-bg-layer> mixes <'background-color'> and <bg-*>, which seems inconsitent.

(4) ... || <'background-origin'> || <'background-clip'> || ... helps explaining in which positions are expected the corresponding longhand values.

Optionally, <bg-image>, <bg-position>, <bg-size>, could be dropped.

(edit) removed specific references to CSS Backgrounds 3 and 4 after d45bed7.

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