(somewhat) Desired result
.parent {
width: 600px;
height: 300px;
--border-opacity: 0.5;
--border-color: rgba(229, 128, 255, var(--border-opacity));
--inner-opacity: 0.2;
--inner-bkg: rgba(255,255,255, var(--inner-opacity));
background: #000;
}
.box {
width:150px;
height:100px;
margin:10px;
border:10px solid var(--border-color);
background:
radial-gradient(farthest-side at bottom right,#0000 98%, var(--border-color)) top left / 30px 30px,
radial-gradient(farthest-side at top right,#0000 98%, var(--border-color)) bottom left / 20px 20px,
radial-gradient(farthest-side at bottom left ,#0000 98%, var(--border-color)) top right / 50px 50px,
radial-gradient(farthest-side at top left ,#0000 98%, var(--border-color)) bottom right/ 10px 10px,
var(--inner-bkg);
background-repeat:no-repeat;
background-origin:padding-box;
}
<div class="parent"><div class="box"/></div>
not
have fixed dimensions, so whatever solution may exist, needs to take into account responsivenessmask
with an inline SVG rect
rect
responsive (it would always need to be i.e. height: calc(100% - var(---border-width * 2))
... same for width.The provided code snippet is the closest I've got to achieving what I need, but there are a few problems.
--inner-opacity
variable affects the border's and the radial-gradient's opacity as well - breakerYou can rely on a simple border-radius
and consider an overflowing coloration to simulate your border.
.box {
border-radius: 10px 20px 30px 40px; /* your radius */
background: #add8e691; /* background color*/
outline: 999px solid rgb(255 0 0/.8); /* border color (don't touch the 999px) */
margin: 20px; /* border thickness */
clip-path: inset(0) margin-box;
height: 100px;
width: 300px;
}
body {
background: repeating-linear-gradient(45deg,#fff 0 10px,#eee 0 20px);
}
<div class="box"></div>