Skip to content

[css-images-4] Add <1d-image> to <image> #7241

@SebastianZ

Description

@SebastianZ

In #2532 it was discussed to allow one-dimensional images in two-dimensional contexts. Lately it was resolved to discuss this feature separately from the original use case of one-dimensional images.

So far, there were four ideas and opinions on them. I've summarized them here (in the order they were mentioned) including their pros and cons:

  1. Add <1d-image> directly to <image>

    Example:

    background-image: stripes(red, yellow, lime, blue);
    shape-outside: stripes(black, transparent 20%);

    Pros:

    • 1D images can be used everywhere where <image> is supported

    Cons:

  2. Add <1d-image> to existing gradient functions

    Examples:

    background-image: linear-gradient(45deg, stripes(red, yellow, lime, blue));
    shape-outside: radial-gradient(stripes(black, transparent 20%));

    Pros:

    • Existing gradient functionality is reused
    • Syntax is reused in different contexts
    • Besides linear stripes also radial and conical stripes and their repeating variants possible

    Cons:

    • Nested functions
    • Semantically incorrect
  3. Create separate stripes functions

    background-image: linear-stripes(45deg, red, yellow, lime, blue);
    shape-outside: radial-stripes(black, transparent 20%);

    Pros:

    • Similar to gradients without nesting

    Cons:

    • Behavior of thickness different to length in gradients
    • No reuse of <1d-image>
  4. Add keyword to existing gradient functions

    background-image: linear-gradient(45deg stripes, red, yellow, lime, blue);
    shape-outside: radial-gradient(stripes, black, transparent 20%);

    Pros:

    • Existing gradient functionality is reused
    • No nesting

    Cons:

    • Behavior of thickness different to length in gradients
    • No reuse of <1d-image>

Sebastian

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