实现左右凹陷中间有虚线效果
效果图
实现思路
从效果图可以看到这个优惠券是左右两边凹陷,中间还有一条虚线,为了封装后插槽使用方便,把优惠券以虚线为准分了两部分。这样布局的好处是上部分内容和下部分都可以自定义,不受内容限制。
实现代码
<style style="text/css">.tickets {padding: 10px;width: 300px;box-sizing: border-box;}
.t-tickets {min-height: 50px;border-radius: 12px 12px 0 0;background-color: bisque;box-shadow: 0px 3px 8px 0px rgba(0,0,0,0.04);-webkit-mask: radial-gradient(circle at 0 bottom, #0000 8px, red 0), radial- gradient(circle at right bottom, #0000 8px, red 0);-webkit-mask-size: 51%;-webkit-mask-position: 0, 100%;-webkit-mask-repeat: no-repeat;}.b-tickets{position: relative;min-height: 50px;width: 100%;border-radius: 0 0 12px 12px;background-color: bisque;box-shadow: 0rpx 3px 8px 0px rgba(0,0,0,0.04);-webkit-mask: radial-gradient(circle at 0 top, #0000 8px, red 0), radial-gradient(circle at right top, #0000 8px, red 0);-webkit-mask-size: 51%;-webkit-mask-position: 0, 100%;-webkit-mask-repeat: no-repeat;
}.line{width: calc(100% - 20px);border-bottom: 1px dotted #fff;margin: 0 10px;
}
</style><div class="tickets"><div class="t-tickets"></div><div class="b-tickets"><div class="line"></div></div>
</div>