CSS3点击按钮圆形进度打钩效果的实现代码


Posted in HTML / CSS onMarch 30, 2021

文章目录 八、CSS3点击按钮圆形进度打钩效果8.1 图片预览8.2 index.html代码8.3 style.css代码


八、CSS3点击按钮圆形进度打钩效果

 8.1 图片预览

CSS3点击按钮圆形进度打钩效果的实现代码
CSS3点击按钮圆形进度打钩效果的实现代码

8.2 index.html代码

<!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>

8.3 style.css代码

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圆形进度按钮内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章,希望大家以后多多支持三水点靠木!

 
HTML / CSS 相关文章推荐
CSS3 渐变(Gradients)之CSS3 径向渐变
Jul 08 HTML / CSS
CSS3实现任意图片lowpoly动画效果实例
May 11 HTML / CSS
使用CSS媒体查询(Media Queries)和JavaScript判断浏览器设备类型的方法
Apr 03 HTML / CSS
纯CSS3大转盘抽奖示例代码(响应式、可配置)
Jan 13 HTML / CSS
CSS3与动画有关的属性transition、animation、transform对比(史上最全版)
Aug 18 HTML / CSS
HTML5拖放功能_动力节点Java学院整理
Jul 13 HTML / CSS
HTML5 CSS3实现一个精美VCD包装盒个性幻灯片案例
Jun 16 HTML / CSS
HTML页面中添加Canvas标签示例
Jan 01 HTML / CSS
canvas之自定义头像功能实现代码示例
Sep 29 HTML / CSS
HTML5中的Web Notification桌面通知功能的实现方法
Jul 29 HTML / CSS
html5 制作地图当前定位箭头的方法示例
Jan 10 HTML / CSS
HTML中link标签属性的具体用法
May 07 HTML / CSS
完美实现CSS垂直居中的11种方法
CSS代码检查工具stylelint的使用方法详解
5个HTML5的常用本地存储方式详解与介绍
CSS实现fullpage.js全屏滚动效果的示例代码
css animation配合SVG制作能量流动效果
如何通过 CSS 写出火焰效果
Html5移动端div固定到底部实现底部导航条的几种方式
Mar 09 #HTML / CSS
You might like
php 无法载入mysql扩展
2010/03/12 PHP
PHP命名空间(Namespace)的使用详解
2013/05/04 PHP
php合并js请求的例子
2013/11/01 PHP
PHP实现的登录,注册及密码修改功能分析
2016/11/25 PHP
laravel框架 api自定义全局异常处理方法
2019/10/11 PHP
jquery插件validate验证的小例子
2013/05/08 Javascript
jquery 模板的应用示例
2013/11/12 Javascript
javascript判断两个IP地址是否在同一个网段的实现思路
2013/12/13 Javascript
jQuery使用之处理页面元素用法实例
2015/01/19 Javascript
ES6通过babel转码使用webpack使用import关键字
2016/12/13 Javascript
详解js产生对象的3种基本方式(工厂模式,构造函数模式,原型模式)
2017/01/09 Javascript
d3绘制基本的柱形图的实现代码
2018/12/12 Javascript
解决Layui 表格自适应高度的问题
2019/11/15 Javascript
如何在 ant 的table中实现图片的渲染操作
2020/10/28 Javascript
Python中强大的命令行库click入门教程
2016/12/26 Python
python实现Decorator模式实例代码
2018/02/09 Python
浅谈Python中的bs4基础
2018/10/21 Python
python3.x+pyqt5实现主窗口状态栏里(嵌入)显示进度条功能
2019/07/04 Python
django中间键重定向实例方法
2019/11/10 Python
pygame库实现移动底座弹球小游戏
2020/04/14 Python
Django {{ MEDIA_URL }}无法显示图片的解决方式
2020/04/07 Python
浅谈优化Django ORM中的性能问题
2020/07/09 Python
Python中使用Selenium环境安装的方法步骤
2021/02/22 Python
CSS3美化表单控件全集
2016/06/29 HTML / CSS
Canvas制作的下雨动画的示例
2018/03/06 HTML / CSS
印度购买眼镜和太阳镜网站:Coolwinks
2018/09/26 全球购物
新锐科技Java程序员面试题
2016/07/25 面试题
J2EE面试题集锦(附答案)
2013/08/16 面试题
医药代表个人求职信范本
2013/12/19 职场文书
团支部推优材料
2014/05/21 职场文书
审计班子对照检查材料
2014/08/27 职场文书
小学生自我评价100字(15篇)
2014/09/18 职场文书
2014年女职工工作总结
2014/11/27 职场文书
毕业论文致谢怎么写
2015/05/14 职场文书
创业计划书之旅游网站
2019/09/06 职场文书
vue elementUI表格控制对应列
2022/04/13 Vue.js