一个漂亮的颜色渐变的按钮

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
			}
			html, body {
				height: 100%;
				overflow: hidden;
			}
			body{
				background: #191919;
				display: flex; /*布局   应用于容器中,也可以应用于行内元素*/
				align-items: center; /*y轴居中*/
				justify-content: center; /*内容向中间对齐*/
			}
			#button{
				background-image: linear-gradient(90deg,#00C0FF,#FFCF00,#FC4F4F);
				display: inline-block;
				padding: 3px;
				border-radius: 7px;
				text-decoration: none;
				animation:randommove 10s linear infinite;
			}
			#button:hover{
				animation:randombackground 10s linear infinite;
			}
			#button span{
				display: inline-block;
				background: #191919;
				color: white;
				padding: 30px 60px;
				border-radius: 7px;
				font-size: 30px;
				font-weight: 800;
				text-transform: uppercase; /*强制字体为大写*/
			}
			@keyframes randommove{
				from{background-position: 0 0;}
				to{background-position: 1000px 0;}
			}
			@keyframes randombackground{
				0%{top:0px; left:0px; background:red;}
				25%{top:0px; left:100px; background:blue;}
				50%{top:100px; left:100px; background:yellow;}
				75%{top:100px; left:0px; background:green;}
				100%{top:0px; left:0px; background:red;}

		</style>
	</head>
	<body>
		<a href="#" id="button">
			<span>Button</span>
		</a>
	</body>
</html>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值