【CSS】 画优惠券锯齿边框样式

红色左右锯齿样式:
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<div class="coupon-input-container"></div>
<style>
.coupon-input-container {
    position: relative;
    background:  #aa0020;
    display: flex;
    width: 280px;
    min-height: 50px;
    padding: 6px 0 6px 15px;
    color: #fff;
    margin-top: 25px;
    align-items: center;
}

.coupon-input-container::before {
    content: ' ';
    width: 0;
    height: 100%;
    width: 0;
    position: absolute;
    border-right: 6px dotted white;
    top: 0;
    left: -3px;    
}

.coupon-input-container::after {
    content: ' ';
    height: 100%;
    position: absolute;
    border-left: 6px dotted white;
    top: 0;
    right: -3px;    

}    
</style>    
</body>
</html>

参考蓝色上下锯齿样式:
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>




<style>
    .dotted {
        position: relative;
        background: -o-linear-gradient(left, #5d95e0, #697dde);
        background: -o-linear-gradient(right, #5d95e0, #697dde);
        background: -moz-linear-gradient(right, #5d95e0, #697dde);
        background: linear-gradient(to right, #5d95e0, #697dde);
        width: 300px;
        height: 200px;
    }


.dotted::before {
    content: ' ';
    width: 0;
    /* height: 100%; */
    height: 0;
    width: 100%;
    position: absolute;
    border-bottom: 10px dotted white;
    top: -5px;
    left: 0px;


}
    

.dotted::after {
    content: ' ';
    height: 0;
    width: 100%;
    position: absolute;
    border-bottom: 10px dotted white;
    bottom: -5px;
    left: 0px;
}
</style>


<body>
    <div class="dotted"></div>
</body>


</html>

参考:用CSS来实现优惠券上的锯齿效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值