纯CSS优惠券样式

HTML

<div class="coupon-box">
  <div class="coupon-box-top"></div>
  <div class="coupon-box-bottom"></div>
</div>

CSS


.coupon-box {
  width: 702px;
}

.coupon-box-top,
.coupon-box-bottom {
  position: relative;
  padding: 24px 28px;
}

.coupon-box-top {
  width: 100%;
  height: 50px;
  background:
    radial-gradient(circle at bottom right, transparent 16px, #fff 0) no-repeat bottom right,
    radial-gradient(circle at bottom left, transparent 16px, #fff 0) no-repeat bottom left;
  background-size: 50% 100%;
  border-radius: 8px 8px 0 0;
}

.coupon-box-top::after {
  content: ' ';
  height: 1px;
  position: absolute;
  left: 16px;
  bottom: 0;
  right: 16px;
  border-bottom: 1px dashed #D9D9D9;
}

.coupon-box-bottom {
  width: 100%;
  height: 100px;
  background:
    radial-gradient(circle at top left, transparent 16px, #fff 0) no-repeat top left,
    radial-gradient(circle at top right, transparent 16px, #fff 0) no-repeat top right;
  background-size: 50% 100%;
  border-radius: 0 0 8px 8px;
}

如果想要自适应高度可以删除widthheight

效果

在这里插入图片描述

相关推荐

  1. CSS样式

    2024-04-23 03:32:03       45 阅读
  2. <span style='color:red;'>css</span><span style='color:red;'>样式</span>

    css样式

    2024-04-23 03:32:03      24 阅读
  3. CSS基础——1.CSS样式

    2024-04-23 03:32:03       33 阅读
  4. CSS3新增样式

    2024-04-23 03:32:03       61 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-23 03:32:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-23 03:32:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-23 03:32:03       82 阅读
  4. Python语言-面向对象

    2024-04-23 03:32:03       91 阅读

热门阅读

  1. ubuntu20.04使用binfmt透明执行riscv64程序

    2024-04-23 03:32:03       31 阅读
  2. std::tuple介绍和使用

    2024-04-23 03:32:03       34 阅读
  3. 大语言模型对于“长序列”的处理方法

    2024-04-23 03:32:03       32 阅读
  4. RTT设备驱动框架学习(UART)

    2024-04-23 03:32:03       39 阅读
  5. vim之一键替换

    2024-04-23 03:32:03       36 阅读
  6. Vue3 ts使用echarts

    2024-04-23 03:32:03       38 阅读
  7. Vue + Cesium(之一)

    2024-04-23 03:32:03       31 阅读