HTML和CSS做优惠券效果

最近看到好几个花里胡哨的作品,不禁感叹,还是能人多。。。。

这是之前做小程序时候,QQ群里分享的一个

代码就贴在下边了,顺便做一下记录

HTML:

<body> <div class="demo"> <!-- 效果1 begin --> <div class="stamp stamp01"> <div class="par"><p>XXXXXX折扣店</p><sub class="sign">¥</sub><span>50.00</span><sub>优惠券</sub><p>订单满100.00元</p></div> <div class="copy">副券<p>2015-08-13<br>2016-08-13</p></div> <i></i> </div> <!-- 效果1 end --> <!-- 效果2 begin --> <div class="stamp stamp02"> <div class="par"><p>XXXXXX折扣店</p><sub class="sign">¥</sub><span>50.00</span><sub>优惠券</sub><p>订单满100.00元</p></div> <div class="copy">副券<p>2015-08-13<br>2016-08-13</p></div> <i></i> </div> <!-- 效果2 end --> <!-- 效果3 begin --> <div class="stamp stamp03"> <div class="par"><p>XXXXXX折扣店</p><sub class="sign">¥</sub><span>50.00</span><sub>优惠券</sub><p>订单满100.00元</p></div> <div class="copy">副券<p>2015-08-13<br>2016-08-13</p><a href="#">立即使用</a></div> <i></i> </div> <!-- 效果3 end --> <!-- 效果4 begin --> <div class="stamp stamp04"> <div class="par"><p>XXXXXX折扣店</p><sub class="sign">¥</sub><span>50.00</span><sub>优惠券</sub><p>订单满100.00元</p></div> <div class="copy">副券<p>2015-08-13<br>2016-08-13</p><a href="#">立即使用</a></div> <i></i> </div> <!-- 效果4 end --> </div> </body>

CSS:

.demo { width:410px; margin:0 auto; } .stamp * { padding: 0; margin: 0; list-style:none; font-family:"Microsoft YaHei", 'Source Code Pro', Menlo, Consolas, Monaco, monospace; } .stamp { width: 387px; height: 140px; padding: 0 10px; margin-bottom: 50px; position: relative; overflow: hidden; } .stamp:before { content: ''; position: absolute; top:0; bottom:0; left:10px; right:10px; z-index: -1; } .stamp i { position: absolute; left: 20%; top: 45px; height: 190px; width: 390px; background-color: rgba(255, 255, 255, .15); transform: rotate(-30deg); } .stamp .par { float: left; padding: 16px 15px; width: 220px; border-right:2px dashed rgba(255, 255, 255, .3); text-align: left; } .stamp .par p { color:#fff; font-size: 16px; line-height: 21px; } .stamp .par span { font-size: 50px; color:#fff; margin-right: 5px; line-height: 65px; } .stamp .par .sign { font-size: 34px; } .stamp .par sub { position: relative; top:-5px; color:rgba(255, 255, 255, .8); } .stamp .copy { display: inline-block; padding:21px 14px; width:100px; vertical-align: text-bottom; font-size: 30px; color:rgb(255,255,255); text-align: center; line-height: initial; } .stamp .copy p { font-size: 16px; margin-top: 15px; } .stamp01 { background: radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 5px, #F39B00 5px); background-size: 15px 15px; background-position: 9px 3px; } .stamp01:before { background-color:#F39B00; } .stamp02 { background: radial-gradient(transparent 0, transparent 5px, #D24161 5px); background-size: 15px 15px; background-position: 9px 3px; } .stamp02:before { background-color:#D24161; } .stamp03 { background: radial-gradient(transparent 0, transparent 5px, #7EAB1E 5px); background-size: 15px 15px; background-position: 9px 3px; } .stamp03:before { background-color:#7EAB1E; } .stamp03 .copy { padding: 10px 6px 10px 12px; font-size: 24px; } .stamp03 .copy p { font-size: 14px; margin-top: 5px; margin-bottom: 8px; } .stamp03 .copy a { background-color:#fff; color:#333; font-size: 14px; text-decoration:none; padding:5px 10px; border-radius:3px; display: block; } .stamp04 { width: 390px; background: radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 4px, #50ADD3 4px); background-size: 12px 8px; background-position: -5px 10px; } .stamp04:before { background-color:#50ADD3; left: 5px; right: 5px; } .stamp04 .copy { padding: 10px 6px 10px 12px; font-size: 24px; } .stamp04 .copy p { font-size: 14px; margin-top: 5px; margin-bottom: 8px; } .stamp04 .copy a { background-color:#fff; color:#333; font-size: 14px; text-decoration:none; padding:5px 10px; border-radius:3px; display: block; } 

不知道原作者是谁,贸然共享出来不知道是否侵权,如有侵权,请联系小弟。。马上删除。。

这儿有个详解的。可以参考下

原文链接:https://blog.csdn.net/max_1414/article/details/101198267?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165277499316782184681137%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165277499316782184681137&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-14-101198267-null-null.nonecase&utm_term=%E4%BC%98%E6%83%A0

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
文明发言,共建和谐米科社区
提交
头像

昵称

取消
昵称表情图片