Skip to content
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

[css-backgrounds] possible examples/diagrams for border-image #7608

Open
jsnkuhn opened this issue Aug 15, 2022 · 4 comments
Open

[css-backgrounds] possible examples/diagrams for border-image #7608

jsnkuhn opened this issue Aug 15, 2022 · 4 comments

Comments

@jsnkuhn
Copy link

jsnkuhn commented Aug 15, 2022

The border-image spec (https://drafts.csswg.org/css-backgrounds/#border-image) is currently light on examples. I wonder if some practice use cases would help folks understand what border-image is used for and maybe use it more?

here's a common corners only pattern Using SVG: https://codepen.io/jsnkuhn/pen/XWEpxVM?editors=1100

Screenshot 2022-07-30 at 08-30-02 XWEpxVM

Gradient examples:

I don't think that gradient as border-image-source was always possible cross browser? This might explain the lack of examples. But pretty sure it has consistent support now

borders on just top and bottom: https://codepen.io/jsnkuhn/pen/VwzZVEP

Screenshot 2022-07-30 at 08-46-52 VwzZVEP

repeating linear gradient barber pole left border: https://codepen.io/jsnkuhn/pen/WNRrYV?editors=0110

Screenshot 2022-07-30 at 08-56-04 Repeating-linear-gradient border-image

border-image-outset: https://codepen.io/jsnkuhn/pen/ZGodKB?editors=1100

border-image-outset

border-image shorthand with labels: https://codepen.io/jsnkuhn/pen/eWzpyz

border-image-shorthand-labeled

border-image shorthand area has no examples right now....

Should probably be similar to how background shorthand area in spec (https://drafts.csswg.org/css-backgrounds/#background) is handled

@jsnkuhn
Copy link
Author

jsnkuhn commented Aug 19, 2022

one of the main responses people give when I bring up corner-shape is "we don't need it because that is one of the primary use cases for border-image". So... seems like we should have some examples of that primary use case in the border-image spec.

https://codepen.io/jsnkuhn/pen/eYMQmoe?editors=0100

The filled shapes on the left side are pretty well usable at different corner sizes (as determined by border-image-width) and element sizes but the bordered examples aren't as adaptable. At different border-image-width values and element sizes the borders get stretched and squished. Maybe someone who's better with SVG might have an idea to deal with this?

These are good use case examples for the border-image-slice fill keyword.

image

@jsnkuhn
Copy link
Author

jsnkuhn commented Aug 21, 2022

bottom border gradient:

https://codepen.io/jsnkuhn/pen/PoRLoKG

image

@jsnkuhn
Copy link
Author

jsnkuhn commented Aug 24, 2022

overlapping border-image on grid items:

https://codepen.io/jsnkuhn/pen/QWmorWr?editors=1100

image

@fantasai fantasai added the css-backgrounds-3 Current Work label Nov 16, 2022
@fantasai
Copy link
Collaborator

These are very cool examples! I'm wondering which ones would make sense to actually integrate in the spec? We generally try to focus on illustrating what the spec is describing, rather than creating a gallery of cool uses. (Otherwise the spec would be mostly cool demos!) But a few examples are often really helpful, to show why features exist or what's possible or how things interact. Are there any particular examples you have here that you think would work well for making the spec more readable? https://www.w3.org/TR/css-backgrounds-3/#border-images

Btw, another place that might be useful to post demos is MDN, particularly if you're trying to get authors to see them: authors are much more likely to look there for examples than the specs, tbh. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants