Css 制作div四角边框效果

文章介绍了如何通过CSS的linear-gradient属性为echarts的外部div创建四角小边框,提供了具体的CSS代码示例,包括不同方向的渐变和背景大小设置,作为替代UI切图的方法。

 在echarts的外部div中添加四角小边框,还是找ui切图快。。。

 

 .box{
    background: linear-gradient(to left, rgb(56, 3, 250), rgb(56, 3, 250)) left top no-repeat,
        // 从右往左的渐变,颜色1到颜色2,,,位置是左上不重复,一根。以下同理
        linear-gradient(to bottom, rgb(56, 3, 250), rgb(56, 3, 250)) left top no-repeat,
        linear-gradient(to left, rgb(56, 3, 250), rgb(56, 3, 250)) right top no-repeat,
        linear-gradient(to bottom, rgb(56, 3, 250), rgb(56, 3, 250)) right top no-repeat,
        linear-gradient(to left, rgb(56, 3, 250), rgb(56, 3, 250)) left bottom no-repeat,
        linear-gradient(to bottom, rgb(56, 3, 250), rgb(56, 3, 250)) left bottom no-repeat,
        linear-gradient(to left, rgb(56, 3, 250), rgb(56, 3, 250)) right bottom no-repeat,
        linear-gradient(to left, rgb(56, 3, 250), rgb(56, 3, 250)) right bottom no-repeat;
      background-size: 2px 20px, 20px 2px, 2px 20px, 20px 2px;
}

linear-gradient参数说明如下:

括号内参数:to bottom/left/right/top表示渐变色的方向和颜色  可以为同一种颜色;

linear-gradient函数后面的left top表示分布在左上方。

background-size: 18px 18px表示每个小框的长度和宽度,

在linear-后面要添加no-repeat表示只显示一遍,不然会一直重复:
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值