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实现绘制各种图形实现代码详细整理
Dec 26 HTML / CSS
css3的@media属性实现页面响应式布局示例代码
Feb 10 HTML / CSS
使用CSS Grid布局实现网格的流动
Dec 30 HTML / CSS
关于css兼容性问题及一些常见问题汇总
May 03 HTML / CSS
CSS3实现王者匹配时的粒子动画效果
Apr 12 HTML / CSS
css3实现小箭头各种图形效果
Jul 08 HTML / CSS
html5-canvas中使用clip抠出一个区域的示例代码
May 25 HTML / CSS
用HTML5实现网站在windows8中贴靠的方法
Apr 21 HTML / CSS
HTML5 Canvas自定义圆角矩形与虚线示例代码
Aug 02 HTML / CSS
前端实现打印图像功能
Aug 27 HTML / CSS
AmazeUI 导航条的实现示例
Aug 14 HTML / CSS
HTML中的表单元素介绍
Feb 28 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的拦截器实例分析
2014/11/03 PHP
PHP读取文件的常见几种方法
2016/11/03 PHP
php正则提取html图片(img)src地址与任意属性的方法
2017/02/08 PHP
PHP接口类(interface)的定义、特点和应用示例
2020/05/18 PHP
js ondocumentready onmouseover onclick onmouseout 样式
2010/07/22 Javascript
15个款优秀的 jQuery 图片特效插件推荐
2011/11/21 Javascript
jquery控制左右箭头滚动图片列表的实例
2013/05/20 Javascript
js中函数调用的两种常用方法使用介绍
2014/07/17 Javascript
jQuery中innerHeight()方法用法实例
2015/01/19 Javascript
jQuery获取标签文本内容和html内容的方法
2015/03/27 Javascript
jQuery实现的老虎机跑动效果示例
2018/12/29 jQuery
教你30秒发布一个TypeScript包到NPM的方法步骤
2019/07/22 Javascript
javascript使用canvas实现饼状图效果
2020/09/08 Javascript
[00:58]他们到底在电话里听到了什么?
2017/11/21 DOTA
python写的一个文本编辑器
2014/01/23 Python
python中使用百度音乐搜索的api下载指定歌曲的lrc歌词
2014/07/18 Python
python中的多线程实例教程
2014/08/27 Python
分享一下Python 开发者节省时间的10个方法
2015/10/02 Python
浅谈Python批处理文件夹中的txt文件
2019/03/11 Python
python 读写文件包含多种编码格式的解决方式
2019/12/20 Python
通过 Python 和 OpenCV 实现目标数量监控
2020/01/05 Python
pandas dataframe 中的explode函数用法详解
2020/05/18 Python
pycharm导入源码的具体步骤
2020/08/04 Python
解决pytorch 模型复制的一些问题
2021/03/03 Python
HTML5 localStorage使用总结
2017/02/22 HTML / CSS
HTML5打开手机扫码功能及优缺点
2017/11/27 HTML / CSS
领先的钻石和订婚戒指零售商:Diamonds-USA
2016/12/11 全球购物
乐高西班牙官方商店:LEGO Shop ES
2019/12/01 全球购物
销售业务实习自我鉴定
2013/09/23 职场文书
四风问题自我剖析材料
2014/10/07 职场文书
实习生辞职信范文
2015/03/02 职场文书
优秀大学生自荐信
2015/03/26 职场文书
MySQL的安装与配置详细教程
2021/06/26 MySQL
JavaScript实现两个数组的交集
2022/03/25 Javascript
Python中re模块的元字符使用小结
2022/04/07 Python
Nginx使用ngx_http_upstream_module实现负载均衡功能示例
2022/08/05 Servers