全部
常见问题
产品动态
精选推荐

从零开始学优惠券样式代码编写,让你的网站焕然一新!

管理 管理 编辑 删除

样式1:

8429a202311250926512312.png

代码实例:


<div class="box">
      <div class="itemBox">
        <div class="leftBox">全额抵扣</div>
        <div class="rightBotton">
          <button>立即使用</button>
        </div>
      </div>
    </div>
 .box {
  background-color: red;
  .itemBox {
    display: flex;
    justify-content: flex-start;
    position: relative;
    border-radius: 10px;
    background-color: #fff;
    &::before {
      content: '';
      position: absolute;
      top: 45%;
      background-color: #f5f5f5;
      width: 12px;
      height: 12px;
      border-radius: 6px;
      left: -5px;
    }
    &::after {
      content: '';
      position: absolute;
      top: 45%;
      background-color: #f5f5f5;
      width: 12px;
      height: 12px;
      border-radius: 6px;
      right: -5px;
    }
    .leftBox {
      border-radius: 10px 0 0 10px;
      background-color: #8b91ff;
      width: 95px;
      height: 90px;
      line-height: 90px;
      font-size: 18px;
      font-weight: bold;
      color: #fff;
      text-align: center;
    }
    .rightBotton {
      margin-left: 18px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      button {
        background-color: #f0f1ff;
        color: #8b91ff;
        height: 28px;
        width: 86px;
        border: none;
        border-radius: 14px;
        font-size: 14px;
      }
    }
  }
}

样式2:

6b329202311250926567074.png

代码实例:

<div class="coupon">
      <div class="coupon-info coupon-hole">
        <div>111</div>
        <div>111</div>
      </div>
      <div class="coupon-get">立即领取</div>
    </div>
.coupon {
  display: inline-flex;
  color: white;
  position: relative;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 1rem;
  /** 这里不能用百分号,因为百分号是分别相对宽和高计算的,会导致弧度不同  */
  border-top-right-radius: 0.3rem;
  border-bottom-right-radius: 0.3rem;
  overflow: hidden;
  background-color: #f39b00;
}
/* 左边框的波浪 */
.coupon::before {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 14px;
  background-image: radial-gradient(white 0, white 4px, transparent 4px);
  /** 如果只设置为半径的两倍(直径),那么半圆之间没有类似堤岸的间隔 */
  background-size: 14px 14px;
  background-position: 0 2px;
  background-repeat: repeat-y;
  z-index: 1;
}
.coupon::before {
  left: -7px;
}
 
.coupon-info {
  padding: 1rem;
  position: relative;
  min-width: 15rem;
  border-right: 2px dashed white;
}
.coupon-info::before {
  top: -0.5rem;
}
.coupon-info::after {
  bottom: -0.5rem;
}
 
/* 使用两个边框为圆角的白色div制造半圆缺角,有个缺点是这个缺角必须与背景色相同(clip-path不好弄) */
.coupon-hole::before,
.coupon-hole::after {
  content: '';
  width: 1rem;
  height: 1rem;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  right: -0.5rem;
}
.coupon-get {
  /** 这里使用flex是为了让文字居中 */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-width: 5rem;
  position: relative;
  padding-left: 0.6rem;
}

样式3:

d4d25202311250927013688.png

代码实例:

<div class="coupon">
      <div class="coupon-info">
        <div>111</div>
        <div>111</div>
        <div>111</div>
      </div>
      <div class="coupon-get">
        <div class="coupon-desc">立即领取</div>
      </div>
    </div>
.coupon {
  display: inline-flex;
  color: white;
  position: relative;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 1rem;
  /** 这里不能用百分号,因为百分号是分别相对宽和高计算的,会导致弧度不同  */
  border-top-right-radius: 0.3rem;
  border-bottom-right-radius: 0.3rem;
  overflow: hidden;
  background-image: linear-gradient(150deg, #f39b00 50%, #f39b00d8 50%);
  // background-image: linear-gradient(150deg, #d24161 50%, #d24161d8 50%);
  // background-image: linear-gradient(150deg, #7eab1e 50%, #7eab1ed8 50%);
  // background-image: linear-gradient(150deg, #50add3 50%, #50add3d8 50%);
}
.coupon::before {
  left: -7px;
}
.coupon::after {
  right: -7px;
}
/* 左边框的波浪 */
.coupon::before,
.coupon::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 14px;
  background-image: radial-gradient(white 0, white 4px, transparent 4px);
  /** 如果只设置为半径的两倍(直径),那么半圆之间没有类似堤岸的间隔 */
  background-size: 14px 14px;
  background-position: 0 2px;
  background-repeat: repeat-y;
  z-index: 1;
}
 
.coupon-info {
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  position: relative;
  min-width: 15rem;
  border-right: 2px dashed white;
}
.coupon-info::before {
  top: -0.5rem;
}
.coupon-info::after {
  bottom: -0.5rem;
}
 
.coupon-get {
  padding: 1rem;
  /** 这里使用flex是为了让文字居中 */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-width: 5rem;
  position: relative;
  .coupon-desc {
    font-size: 18px;
    font-weight: bold;
  }
}

样式4:

34103202311250927064531.png

代码实例:

<div class="quan">
    <div class="quanInfo">
      <div>111</div>
      <div>111</div>
    </div>
    <div class="receiveBtn">
      <div class="receive">使用</div>
    </div>
  </div>
.quan {
  margin: 22px 37px;
  background-color: #17dbcb;
  border-radius: 10px;
  display: flex;
  width: 400px;
  height: 100px;
}
 
.quanInfo {
  background-image: radial-gradient(
      circle at right top,
      #ffffff,
      #ffffff 15px,
      transparent 16px
    ),
    radial-gradient(
      circle at right bottom,
      #ffffff,
      #ffffff 15px,
      transparent 16px
    );
  border-right: 1px dashed #f64f51;
  padding: 30px 50px;
  width: 70%;
}
.receiveBtn {
  background-image: radial-gradient(
      circle at left top,
      #ffffff,
      #ffffff 15px,
      transparent 16px
    ),
    radial-gradient(
      circle at left bottom,
      #ffffff,
      #ffffff 15px,
      transparent 16px
    );
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -2px;
  background-color: pink;
}
.receive {
  border-radius: 23px;
  background-color: #5fc484;
  padding: 7px 31px;
  text-align: center;
  width: 30px;
  margin: 0 20px;
  font-size: 12px;
  color: #ffffff;
}

样式5:

48c7a202311250927306453.png

代码实例:

<div class="coupon">
   <div class="aa">111</div>
</div>
.coupon {
  position: relative;
  width: 290px;
  height: 100px;
  background: radial-gradient(circle at right top, transparent 15px, red 0) top
      left/90px 50% no-repeat,
    radial-gradient(circle at right bottom, transparent 15px, red 0) bottom
      left/90px 50% no-repeat,
    radial-gradient(circle at left top, transparent 15px, pink 0) top
      right/200px 50% no-repeat,
    radial-gradient(circle at left bottom, transparent 15px, pink 0) bottom
      right/200px 50% no-repeat;
  .aa {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    color: pink;
  }
}


请登录后查看

CRMEB-慕白寒窗雪 最后编辑于2023-11-25 10:01:34

快捷回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
排序 默认正序 回复倒序 点赞倒序

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}

作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest==1? '取消推荐': '推荐'}}
沙发 板凳 地板 {{item.floor}}#
{{item.user_info.title}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
{{item.like_count}}
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

作者 管理员 企业

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}   {{itemc.ip_address}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
查看更多
回复
回复
1598
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

快速安全登录

使用微信扫码登录
{{item.label}} {{item.label}} {{item.label}} 板块推荐 常见问题 产品动态 精选推荐 首页头条 首页动态 首页推荐
加精
取 消 确 定
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定

微信登录/注册

切换手机号登录

{{ bind_phone ? '绑定手机' : '手机登录'}}

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 源码下载 CRMEB帮助文档 帮助文档
返回顶部 返回顶部
CRMEB客服