Button with inverted rounded corners + border

I am trying to recreate the attached button in CSS. This button has inverted rounded corners with also a border on the whole button (also on the corners). I am able to create the rounded corners but I am with the borders. You can see what I have here: https://codepen.io/Rultar/pen/emOWqBx
No description
12 Replies
Rultar
RultarOP2d ago
Thanks!
Tok124 (CSS Nerd)
Actually, you could just do this xD
#main {
height: 100px;
width: 500px;
background-color: #05253a;
position: relative;
overflow: hidden;
box-shadow:inset 0 0 0 3px #b78825;
}
#main {
height: 100px;
width: 500px;
background-color: #05253a;
position: relative;
overflow: hidden;
box-shadow:inset 0 0 0 3px #b78825;
}
MarkBoots
MarkBoots2d ago
here my try with a single element, using masks and gradients https://codepen.io/MarkBoots/pen/YPKVmMQ don't touch the scary bit 😜
No description
capt_uhu
capt_uhu2d ago
desperately needs variables but here's my attempt: https://codepen.io/jsnkuhn/pen/OPLmKKE
capt_uhu
capt_uhu2d ago
there's also this generator: https://css-generators.com/custom-corners/
CSS Generator for Custom Corners (Scooped, Beveled, and more)
Cut the corners of your element using CSS mask or clip-path. Get an optimized & modern code in no time.
MarkBoots
MarkBoots2d ago
you just let me feel really dumb 😁 , offcourse i could have just used the repeating nature of backgrouds/mask. just offset it a bit.... (never code after midnight)
capt_uhu
capt_uhu2d ago
sorry didn't see yours
MarkBoots
MarkBoots2d ago
i've updated mine with your approach and the variables https://codepen.io/MarkBoots/pen/YPKVmMQ
No description
dosalover47
dosalover472d ago
can someone tell me whats the easiest noob friendly method 🙂 ? approach*
capt_uhu
capt_uhu2d ago
so here's another approach that gets out of the way of background-image so peeps can use that: https://codepen.io/jsnkuhn/pen/MYgoKOZ you have touched on the primary problem here: there unfortunately isn't really a "nooby friendly" method for this. There's this mythical CSS property called "border-corner-shape" that's been in a draft spec for 12 years but it has never been implemented by any browsers.... Here's my paintAPI take on what it would be like: https://jsnkuhn.github.io/corner-shape/ it's pretty rough because the paintAPI also has bad support. Looking at it on chrome or edge should give the best results. if you're OK with using images for this border-image can be helpful. The big issue is that you lose control of most styling through CSS: https://codepen.io/jsnkuhn/pen/eYMQmoe
MarkBoots
MarkBoots2d ago
i thought of border-image too, but if you want a wider line (wherefor you also use the inset shadow), it will start to cover the padding- and content-box as well. i was thinking of adding a transparent border so it creates the space for it, but then the inset shadow won't line up. unfortunately it's not possible to combine multiple border-images so it can also do the horizontal/vertical line It could work with an outline instead of the inset shadow https://codepen.io/MarkBoots/pen/YPKQwbQ?editors=1100

Did you find this page helpful?