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实现毛玻璃效果示例源码
Sep 25 HTML / CSS
CSS3使用border-radius属性制作圆角
Dec 22 HTML / CSS
css3 flex布局 justify-content:space-between 最后一行左对齐
Jan 02 HTML / CSS
CSS3 filter(滤镜)实现网页灰色或者黑色模式的示例代码
Feb 24 HTML / CSS
HTML5组件Canvas实现图像灰度化(步骤+实例效果)
Apr 22 HTML / CSS
HTML5 DeviceOrientation实现手机网站摇一摇功能代码实例
Apr 24 HTML / CSS
详解HTML5中的picture元素响应式处理图片
Jan 03 HTML / CSS
html5录音功能实战示例
Mar 25 HTML / CSS
一个基于canvas的移动端图片编辑器的实现
Oct 28 HTML / CSS
CSS3实现列表无限滚动/轮播效果
Jun 23 HTML / CSS
css布局巧妙技巧之css三角示例的运用
Mar 16 HTML / CSS
什么是css原子化,有什么用?
Apr 24 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 define函数的使用说明
2008/08/27 PHP
利用PHP生成静态HTML文档的原理
2012/10/29 PHP
php使用APC实现实时上传进度条功能
2015/10/26 PHP
PHP内核学习教程之php opcode内核实现
2016/01/27 PHP
PHP实现长文章分页实例代码(附源码)
2016/02/03 PHP
浅谈php中变量的数据类型判断函数
2017/03/04 PHP
将CKfinder整合进CKEditor3.0的新方法
2010/01/10 Javascript
jQuery中attr()和prop()在修改checked属性时的区别
2014/07/18 Javascript
javascript简单实现图片预加载
2014/12/03 Javascript
谈谈JavaScript中function多重理解
2015/08/28 Javascript
javascript实现简单加载随机色方块
2015/12/25 Javascript
让图片跳跃起来  javascript图片轮播特效
2016/02/16 Javascript
全面解析Bootstrap中transition、affix的使用方法
2016/05/30 Javascript
AngularJS自定义插件实现网站用户引导功能示例
2016/11/07 Javascript
基于javascript的Form表单验证
2016/12/29 Javascript
Vue 开发音乐播放器之歌手页右侧快速入口功能
2018/08/08 Javascript
如何自定义微信小程序tabbar上边框的颜色
2019/07/09 Javascript
Vue使用screenfull实现全屏效果
2020/09/17 Javascript
Windows下的Python 3.6.1的下载与安装图文详解(适合32位和64位)
2018/02/21 Python
使用Python实现企业微信的自动打卡功能
2019/04/30 Python
python实现随机漫步方法和原理
2019/06/10 Python
Python OpenCV实现鼠标画框效果
2020/08/19 Python
Python tkinter实现图片标注功能(完整代码)
2019/12/08 Python
Django 限制访问频率的思路详解
2019/12/24 Python
python让函数不返回结果的方法
2020/06/22 Python
Pyqt助手安装PyQt5帮助文档过程图解
2020/11/20 Python
html5本地存储_动力节点Java学院整理
2017/07/12 HTML / CSS
波兰灯具、照明和LED购物网站:Lampy.pl
2019/03/11 全球购物
数控专业毕业生求职信范文
2013/09/21 职场文书
银行学习十八大感想
2014/01/11 职场文书
单位实习证明怎么写
2014/01/17 职场文书
爱晚亭导游词
2015/02/09 职场文书
通知函的格式
2015/04/27 职场文书
工会文体活动总结
2015/05/07 职场文书
golang 定时任务方面time.Sleep和time.Tick的优劣对比分析
2021/05/05 Golang
Redis三种集群模式详解
2021/10/05 Redis