用css3怎样做点击圆形按钮显示正确图片的效果?
Admin 2021-10-18 群英技术资讯 792 次浏览
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CSS3点击按钮圆形进度打钩效果</title> <!--图标库--> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css'> <!--核心样式--> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="background"> <input type="checkbox" id="button"> <label for="button" class="button"> 点击按钮<i class="fas fa-check"></i></label> <svg class="circle"> <circle cx="32" cy="32" r="31"> </svg> </div> </body> </html>
body { margin: 0; height: 100vh; width: 100vw; display: flex; align-items: center; justify-content: center; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 14px; } .background { position: relative; background: linear-gradient(to top, #49b26e 0%, #57d895 100%); border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-direction: column; box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.25); width: 400px; height: 400px; color: white; } .background input { display: none; } .background .button { display: flex; justify-content: center; align-items: center; width: 260px; height: 60px; border: 2px solid white; border-radius: 30px; text-align: center; font-size: 20px; text-transform: uppercase; font-weight: bold; letter-spacing: 2px; transition: all 0.3s ease-in-out; cursor: pointer; } .background .button:hover { background-color: #37be77; } .background .button .fas { position: absolute; color: #4caf50; z-index: 2; opacity: 0; } .background .circle { position: absolute; width: 65px; height: 65px; fill: none; stroke: white; stroke-width: 2px; stroke-linecap: round; stroke-dasharray: 183 183; stroke-dashoffset: 183; opacity: 0; left: 0; bottom: 0; right: 0; top: 0; margin: auto; pointer-events: none; transform: rotate(-90deg); } .background input:checked~.button { animation: button 0.5s ease both, fill 0.5s ease-out 1.5s forwards; } .background input:checked~.button .fas { animation: check 0.5s ease-out 1.5s both; } .background input:checked~.circle { animation: circle 2s ease-out 0.5s both; } @keyframes button { 0% { width: 260px; left: 70px; border-color: white; color: white; } 50% { color: transparent; } 100% { width: 60px; left: 170px; border-color: #45b078; background: transparent; color: transparent; } } @keyframes circle { 0% { stroke-dashoffset: 183; } 50% { stroke-dashoffset: 0; stroke-dasharray: 183; transform: rotate(-90deg) scale(1); opacity: 1; } 90%, 100% { stroke-dasharray: 500 500; transform: rotate(-90deg) scale(2); opacity: 0; } } @keyframes fill { 0% { background: transparent; border-color: white; } 100% { background: white; } } @keyframes check { 0% { opacity: 0; } 100% { opacity: 1; } }
以上就是用css3实现点击圆形按钮显示正确图片效果的代码,有需要的朋友可以参考,希望对大家学习css3的使用有帮助,想要了解更多可以继续浏览群英网络其他相关的文章。
文本转载自脚本之家
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
本篇文章主要的为大家讲述的是关于html meta标签的三要素,就是三属性的组成和使用的介绍,里面有很多比较重要的属性值,在网页中都是很有用的,现在让我们一起来看这篇文章吧
大家都知道在css中最重要的就是布局,但是在CSS div布局中我们要非常的小心,不然我们的网站就会变得不美观,那么你知道CSS div布局需要注意什么吗?
一、段落样式css中关于段落的样式主要有行高,缩进,段落对齐,文字间距,文字溢出,段落换行等。它们的具体语法如下:line-height:normal|lengthtext-indent:lengthtext-align:left|right|center|justifyletter-spacing:normal|l
这篇文章给大家分享的是用CSS3实现动态渐变背景的示例。对于渐变效果的实现大家应该都比较熟悉,那么如果是动态变化的渐变效果该如何做呢?实现代码及效果如下,文中的示例代码介绍得很详细,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
我们先理理思路,大家想一想,梯形是怎么构成的,小学的数学课本都讲过的,就拿等腰梯形来说, 是由两个直角三角形,和一个长方形或正方形组成的,看草图↓ 这意味着,我们要用一个&
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008