-
Notifications
You must be signed in to change notification settings - Fork 713
[css-borders] Multi-layer support for border-image
#8802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Regarding border-radius, I don't think it makes sense for 2D images. It can make sense for |
OK sure, I thought you wanted another effect, that's not suitable for background: linear-gradient(to bottom right, #3c3c3c, #292929) padding-box,
linear-gradient(to bottom right, #ffffff, #ffff00, #ff0000, #ff00ff) border-box; Full code<!DOCTYPE html>
<style>
:root {
background: #555555;
}
div {
background: linear-gradient(to bottom right, #3c3c3c, #292929) padding-box,
linear-gradient(to bottom right, #ffffff, #ffff00, #ff0000, #ff00ff) border-box;
border: 1px solid transparent;
border-radius: 1em;
height: 100px;
width: 200px;
padding: 1em;
color: #ffffff;
}
</style>
<div>Lorem ipsum</div> |
Oh, huh - that actually works really cleanly! I still personally feel like it could be wrapped into borders themselves, but I understand why it wouldn't quite fit. I'll still leave this issue up for the sake of multi-layer border images, though - that feels like a generally good idea overall. |
The issue with the 2 layers of gradients to solve this is that it makes using an actual background image a bit more difficult than is ideal. I also don't see a way to use a transparent background with this? For the moment an SVG border-image that includes the gradient filled stroke is probably the best way to go unless you need the gradient to animate on hover i guess. Having a straightforward CSS solution for this would still be ideal. Also here is a previous issue regarding manipulating the |
border-image
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:background-image
, border image sources cannot be layered.2. Border images are fully unaffected byborder-style
andborder-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.
The text was updated successfully, but these errors were encountered: