I am having trouble figuring out how to create an element that can meet the following requirements:
- have a transparent background as to allow it's parent's background to come through
- have a border radius
- have a linear gradient border
My current implementation can satisfy all but 1.
<div class="box">
</div>
html {
background: red;
}
.box {
width: 400px;
height: 400px;
border-radius: 8px;
background: black;
background-clip: padding;
border: none;
margin: 40px;
position: relative;
&:before {
border-radius: inherit;
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: -4px;
z-index: -1;
background: linear-gradient(#8800cc, #fff)
}
}
I've also seen other implementations that allow for 1 and 3, but not 2 via border-images.
Is there any solution (even if it's on the bleeding edge of browser support) that can meet all 3 requirements?