最佳答案
您可以使用 :before
伪元素和 linear-gradient
来创建类似边框的效果。
.element {
background: white;
position: relative;
width: 200px;
height: 150px;
margin: 50px;
}
.element:before {
content: '';
position: absolute;
left: -5px;
top: -5px;
width: calc(100% + 10px);
height: calc(100% + 10px);
background: linear-gradient(45deg, rgba(220, 218, 219, 1) 0%, rgba(255, 255, 255, 1) 42%, rgba(255, 255, 255, 1) 59%, rgba(125, 188, 220, 1) 100%);
z-index: -1;
}
<div class="element"></div>
关于css - 从左、上、下、右渐变颜色的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39203482/