码迷,mamicode.com
首页 > Web开发 > 详细

CSS实现漂亮的小水球效果

时间:2020-05-24 09:22:19      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:after   pos   water   uppercase   插入图片   style   http   size   animation   

先看效果图:
技术图片
代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>小水球</title>
		<style>
			*{
				margin:0;
				padding: 0;
			}
			body{
				height: 100vh;
				background: linear-gradient(rgb(95,95,250) 10%,rgb(3,3,110));
			}
			
			.main,.wave{
				width:200px;
				height:200px;
				border-radius: 50%;
				position: absolute;
				left: 50%;
				top:50%;
				transform: translate(-50%,-50%);
			}
			.main{
				border:3px solid darkturquoise;
				padding: 10px;
			}
			.wave{
				background: darkturquoise;
				overflow: hidden;
			}
			.wave::before{
				content: "水球";
				position: absolute;
				left: 50%;
				top: 0px;
				color: darkturquoise;
				z-index: 99;
				transform: translate(-50%,30px);
				text-transform: uppercase;
			}
			.wave::after{
				content: "";
				width: 300px;
				height: 300px;
				background: rgba(255,255,255,0.8);
				position: absolute;
				left: 50%;
				top: 0;
				transform: translate(-50%,-60%);
				border-radius: 40%;
				animation: wave 5s linear infinite;
			}
			
			@keyframes wave{
				100%{
					transform: translate(-50%,-60%) rotate(360deg);
				}
			}
		</style>
	</head>
	<body>
		<div class="main">
			<div class="wave"></div>
		</div>
	</body>
</html>

参考视频:https://www.bilibili.com/video/BV1nV411d7Q2

CSS实现漂亮的小水球效果

标签:after   pos   water   uppercase   插入图片   style   http   size   animation   

原文地址:https://www.cnblogs.com/AlexanderZhao/p/12945716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!