×

用CSS实现模块边框的渐变

作者:andy0012018.08.23来源:Web前端之家浏览:28508评论:0
关键词:渐变

用CSS实现模块边框的渐变,一起来看下demo.

<div class="gradient-block-vertical"></div>
<div class="gradient-block-horisontal"></div>
<div class="gradient-block-diagonal"></div>
.gradient-block-vertical {
    float:left;
    margin:50px;
    width:250px;
    height:250px;
    box-sizing:border-box;
    border:20px solid transparent;
    background-clip:padding-box,border-box;
    background-origin:padding-box,border-box;
    background-image:linear-gradient(#fff,#fff),linear-gradient(#FD6A74,#FEB378);
}
.gradient-block-horisontal {
    margin:50px;
    float:left;
    width:250px;
    height:250px;
    box-sizing:border-box;
    border:20px solid transparent;
    background-clip:padding-box,border-box;
    background-origin:padding-box,border-box;
    background-image:linear-gradient(90deg,#fff,#fff),linear-gradient(90deg,#5c5fa5,#893f60);
}
.gradient-block-diagonal {
    float:left;
    position:relative;
    width:250px;
    height:250px;
    margin:50px;
    box-sizing:border-box;
    border:20px solid transparent;
    background-clip:padding-box,border-box;
    background-origin:padding-box,border-box;
    background-image:linear-gradient(45deg,#fff,#fff),linear-gradient(45deg,#5c5fa5,#893f60);
}

效果如下:

图片.png

大家 可以去尝试下。

您的支持是我们创作的动力!
温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/ccss234234235.html

网友评论文明上网理性发言 已有0人参与

发表评论: