线性优惠券样式

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .coupon_wrap {
            display: flex;
            position: relative;
            width: 160px;
            height: 50px;
            align-items: center;
            justify-content: center;
            border: 1px solid #cd2314;
            box-sizing: border-box;
        }

        .c_l {
            position: absolute;
            top: 50%;
            left: -1px;
            transform: translate(0, -50%);
            width: 10px;
            height: 20px;
            background-color: #fff;
            border-radius: 0 50px 50px 0;
            border: 1px solid #cd2314;
            border-left: 1px solid #fff;
        }

        .c_r {
            position: absolute;
            top: 50%;
            right: -1px;
            transform: translate(0, -50%);
            width: 10px;
            height: 20px;
            background-color: #fff;
            border-radius: 50px 0 0 50px;
            border: 1px solid #cd2314;
            border-right: 1px solid #fff;
        }

        p {
            text-align: center;
            color: #cd2314;
            margin: 0;
        }
    </style>
</head>

<body>
    <div class="coupon_wrap">
        <p>满300减200</p>
        <div class="c_l"></div>
        <div class="c_r"></div>
    </div>

</body>

</html>

效果图,利用的是border实现 

猜你喜欢

转载自blog.csdn.net/CrazBarry/article/details/108324075