CSS实现各种优惠券效果

一、左半圆效果

复制代码
<style style="text/css">
	.coupon {
	  width: 240px;
	  height: 100px;
	  margin-top: 15px;
	  background-color: #ff6347;
	  -webkit-mask: radial-gradient(circle at left center, transparent 20px, red 20px); 
	}
</style>

<div class="coupon"></div>

二、左右半圆效果

复制代码
<style type="text/css">
.coupon2 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient(circle at 0, #0000 20px, red 0), radial-gradient(circle at right, #0000 20px, red 0);
  -webkit-mask-size: 51%;
  -webkit-mask-position: 0, 100%;
  -webkit-mask-repeat: no-repeat;
}
</style>
<div class="coupon2"></div>

三、左内圆效果

复制代码
<style type="text/css">
.coupon3 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient(circle at 20px, #0000 20px, red 0); 
}
</style>
<div class="coupon3"></div>

四、四角收缩效果

复制代码
<style type="text/css">
.coupon4 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient(circle at 20px 20px, #0000 20px, red 0); 
  -webkit-mask-position: -20px -20px;
}
</style>
<div class="coupon4"></div>

缩写
.coupon4 {
  -webkit-mask: radial-gradient(circle at 20px 20px, #0000 20px, red 0) -20px -20px; 
}

五、六角收缩效果

复制代码
<style type="text/css">
.coupon5 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient(circle at 20px 20px, #0000 20px, red 0); 
  -webkit-mask-position: -20px -20px;
  -webkit-mask-size: 50%;
}
</style>
<div class="coupon5"></div>

缩写
.coupon5 {
  -webkit-mask: radial-gradient(circle at 20px 20px, #0000 20px, red 0) -20px -20px / 50%; 
}

六、凹边效果

复制代码
<style type="text/css">
.coupon6 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient(circle at 10px, #0000 10px, red 0); 
  -webkit-mask-position: -10px;
  -webkit-mask-size: 100% 30px;
}
</style>
<div class="coupon6"></div>

七、中排圆点效果

复制代码
<style type="text/css">
.coupon7 {
  width: 300px;
  height: 130px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient( circle at 50%, red 5px, transparent 0) 50% 50% / 100% 20px, radial-gradient(circle at 20px 20px, transparent 20px, red 0) -20px -20px / 50%;
  -webkit-mask-composite: destination-out;
}
</style>
<div class="coupon7"></div>

八、两边凹陷效果

复制代码
<style type="text/css">
.coupon8 {
  width: 240px;
  height: 100px;
  margin-top: 15px;
  background-color: #F56C6C;
  -webkit-mask: radial-gradient( circle at 5px, red 5px, transparent 0) -5px 50% / 100% 20px, radial-gradient(circle at 20px 20px, transparent 20px, red 0) -20px -20px / 50%;
  -webkit-mask-composite: destination-out;
}
</style>
<div class="coupon8"></div>
相关推荐
贵沫末5 分钟前
React——基础
前端·react.js·前端框架
每天开心9 分钟前
深入理解 CSS 选择器:从基础到高级
css·html·ai编程
aklry16 分钟前
uniapp三步完成一维码的生成
前端·vue.js
Rubin9323 分钟前
判断元素在可视区域?用于滚动加载,数据埋点等
前端
爱学习的茄子24 分钟前
AI驱动的单词学习应用:从图片识别到语音合成的完整实现
前端·深度学习·react.js
用户38022585982424 分钟前
使用three.js实现3D地球
前端·three.js
程序无bug27 分钟前
Spring 面向切面编程AOP 详细讲解
java·前端
zhanshuo27 分钟前
鸿蒙UI开发全解:JS与Java双引擎实战指南
前端·javascript·harmonyos
JohnYan27 分钟前
模板+数据的文档生成技术方案设计和实现
javascript·后端·架构
撰卢1 小时前
如何提高网站加载速度速度
前端·javascript·css·html