w3c / w3c/csswg-drafts

[css-borders] Multi-layer support for `border-image`

Open
#8,802 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-borders-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Spec: https://w3c.github.io/csswg-drafts/css-backgrounds/#border-images

The current state of border-image is...less than stellar. There are two main problems I've run into:

  1. Unlike background-image, border image sources cannot be layered.
    2. Border images are fully unaffected by border-style and border-radius.

The former is a simple parity issue - the value of border-image-source could be converted from none | <image> to <bg-image># without breaking existing CSS, and the other border-image properties could be made to support groups as well.

While the latter makes a lot of sense for using a sliced image, this becomes an issue if you want to use a gradient as a border - as <gradient> is a subtype of <image>, this results in gradient borders being unable to use the features you'd use with a solid-colored or hidden border. While there are workarounds, they're not pretty - take for example this post from blep on cohost.

I'm not quite sure of an optimal solution for this, as changing it would inherently change the visual presentation of any websites that use the current behavior. However, I feel it's still important to consider, as design trends like neumorphism are starting to bring back gradients in ways where having a gradient border with a radius would be desirable.

I'm new to spec proposals, so please don't hesitate to let me know if I've missed anything! Thank you for your time!

EDIT: second point is generally resolved, but I still feel like multi-layer border images would be worth proposing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CSS Backgrounds border-images section and compare its current grammar with the issue's proposed layered syntax. Work out the specification impact for border-image-source and related properties, then document a complete multi-layer proposal for CSSWG review.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.