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-4] Use cases for corner-shape #6980
Comments
ANGLE EXAMPLES
https://www.zelda.com/ (footer links)
https://thewitcher.com/en/witcher3
https://www.leagueoflegends.com/en-us/
button{
corners: angle 11px 0;
transition: corners .25s;
}
button:hover{
corners: angle 0 0;
}
ANGLE AND NOTCHhttps://playvalorant.com/en-us/
|
|
It seems to me that almost all of these examples are bevel corners and various types of polygons/parallelograms/trapezoids etc. None of them are using Furthermore, I feel that using This allows creating "bevel" corners like this: --corner-size: 10px;
element-shape: polygon(
var(--corner-size) 0, calc(100% - var(--corner-size)) 0, /* top */
100% var(--corner-size), 100% calc(100% - var(--corner-size)), /* right */
calc(100% - var(--corner-size)) 100%, var(--corner-size) 100%, /* bottom */
0 calc(100% - var(--corner-size))
);…which is admittedly a lot more involved than From what I remember the tricky bit of implementing/specifying all of these is border geometry, especially when top, right, bottom, left borders all have different thicknesses and/or colors. Given that the use cases that actually require a non-uniform border AND a custom shape are practically nil, I wonder if there's an easy way to get this out of the way, even if the visual result in these rare cases is suboptimal. @fantasai would love your input. |
|
Anothe useful, though not much used because of difficuilty of implementation, corner shape seems to be the "squircle" or "superellipse" shape, or at least its approximation with Bezier curves. Searching for "CSS squircles" shows quite a lot of attempts to solve it with existing tools (mostly complex clip-path or even Houdini). |
That is yet another argument for |
|
@SelenIT wrote:
In #6296 I suggested
|
|
Did run across a 4 corner notched example. Something like https://www.zelda.com/links-awakening/ Very much agree that corner-shape for polygons gets messy. Once you start using the slash syntax to give corners different widths and heights things get hard to follow. And even more when you throw a 100% corner height or width in it kinda ceases to be a corner anymore. Didn't @tabatkins post something on twitter not too long ago about an idea for a CSS syntax for creating SVGs? What makes the polygon creating an issue is all the |
|
Maybe |
They already are independent in everything but |
|
found the tweet I mentioned above:
Also was just thinking that when |
|
still not having a whole lot of luck finding scoop or notch examples. If anyone knows of places where these are common please don't hesitate to drop links or point in the right direction. https://diamondpearl.pokemon.com/en-us/
https://nierautomata.square-enix-games.com/en-us/home/
https://www.guerrilla-games.com/play/horizon
https://www.animal-crossing.com/new-horizons/
https://unite.pokemon.com/en-us/
|
|
Because someone is likely to ask... No you couldn't really do the twitter NFT shape with corner-shape. The general hexagon shape yes, but you'd need an SVG path to get all the detail. corner-shape: bevel (angle)
border-radius: 25% / 50%
width: 400px
height: 300px |
|
@LeaVerou wrote:
I love the idea of being able to define individual shapes for elements. Though I believe this goes far beyond the use case of specifying a different shape for a corner defined via Sebastian |
|
I think the problem with finding scoop and notch examples is that there isn't an easy way to hack them. Using 'border-image' requires an image, and trying to do it a vector image (SVG) is complicated and slow-rendering and sometimes inconsistent. I think if 'corner-shape' existed and could do scoops, we'd see a lot more designs with scoops, as there are in print design. |
|
If something is doable with an image, that's annoying but not enough to deter people from using it in production. People have been using images for effects they cannot do in CSS for decades. |
|
I'm not keen on having yet another way to create polygons and paths. I'd rather we found a way to unite shape-outside and clip-path, and apply borders and box-shadows and filters to those shapes (maybe a keyword to shape-outside or clip-path that does that, with only border-top going all the way around the shape, and maybe with an extra control for how pointy or rounded the miters are). |
|
I agree with Brad's comments above - we already have these concepts in CSS, we shouldn't be trying to reinvent an (arbitrarily-shaped) wheel. Someone mentioned
So, personally, I'd go with something more like a single
As this builds on the conceptual models of |
|
VScode
discord.com
https://www.smashbros.com/en_US/
https://www.starwars.com/news/brian-volk-weiss-interview
https://festival.gamesforchange.org/
opera GX new tab page
|
|
some observations from this so far:
|
|
Maybe the start of a more complete paint API polyfill for corner-shape? Currently supports only angled corners but with the option for the full 8 value border-radius/corner-size syntax (ie |
I think you are probably right. As one of the authors of that spec, it is disappointing, but I also don't use it much. With raster images:
SVG can be used, but that adds different complications. It can be super complicated, depending on what you are trying to achieve, and it can render slowly, and there are browser differences.
I think I tend to be in that camp, especially with raster images. |
|
Another scooped corners example https://playwonderlands.2k.com/
|
|
Don't really know how many more angle/bevel examples we really need but thought this was notable because its a rather big named site: https://www.marcustheatres.com/
|
|
Update on the paint API polyfill for corner-shape I was making: it now mostly works! Supports angle, notch, scoop, square and round shapes. No % support yet for sizes. Demo page can be found here (chromium only for now): https://jsnkuhn.github.io/corner-shape/ |
|
So this is a little bit different but still use case related: note the styling difference between the promo image from a blog post (on the top) and the way the same thing is styled on the website (on the bottom) This is just speculation on my part but i'm guessing they would be more similar if it would be easier to do: |
|
Was just getting caught up on Westworld and found it interesting how many of these "futuristic" looking UI things would be easy with something like corner-shape: corners: 20px angle round round;This includes a live take on the keyboard interface with my in process paintAPI polyfill (chrome only for now) |
|
Finally found an example of a site that uses https://elderscrolls.bethesda.net/en/skyrim the clip-path: polygon(calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%, 20px 0%);vs corners: angle 40px; |
|
https://www.residentevil.com/village/us/
https://www.videogameschronicle.com/
|
|
discord.com
But this brings up the idea of animating between different I assume that https://bethesda.net/en/game/starfield/media?type=video
|





































The point of this thread is to collect designs from existing websites where
corner-shapewould make web developers jobs easier. Current live sites are preferred to demos.Some related links:
Similar thread from 2013 when the idea of
corner-shapewas first introduced:https://lists.w3.org/Archives/Public/www-style/2013Mar/0505.html
Lea's original svg corner-shape demo:
https://projects.verou.me/corner-shape/
The working draft spec in it's current state:
https://drafts.csswg.org/css-backgrounds-4/#corner-shaping
The text was updated successfully, but these errors were encountered: