CSS太阳月亮地球三角恋旋转效果
纯粹玩一下,好像没有什么实际的卵用,but,纯玩买不了上当,纯玩买不了受骗。。。。。。。。
地月旋转的一个css效果,无聊玩玩,可以复制到记事本试试
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS地心旋转效果</title>
<style>
.box
{
transform: scale(0.5);
position: relative;
padding: 1px;
height: 300px;
width: 300px;
margin:100px auto;
}
.sunline
{
position:relative;
height: 400px;
width: 400px;
border: 2px solid black;
border-radius: 50%;
margin: 50px 0 0 50px;
display: flex;
animation: rotate 10s infinite linear;
}
.sun
{
height: 100px;
width: 100px;
margin: auto;
background-color: red;
border-radius: 50%;
}
.earthline
{
position: absolute;
right: 0;
top: 50%;
height: 200px;
width: 200px;
margin: -100px -100px 0 0;
border: 1px solid black;
border-radius: 50%;
display: flex;
animation: rotate 2s infinite linear;
}
.earth
{
margin: auto;
height: 50px;
width: 50px;
background-color: green;
border-radius: 50%;
}
.moon
{
position: absolute;
left: 0;
top: 50%;
height: 20px;
width: 20px;
margin: -10px 0 0 -10px;
background-color: gray;
border-radius: 50%;
}
@keyframes rotate
{
100%{transform:rotate(360deg);
}
}
</style>
</head>
<body>
<!-- 代码部分begin -->
<div class="box">
<div class="sunline">
<div class="sun"></div>
<div class="earthline">
<div class="earth"></div>
<div class="moon"></div>
</div>
</div>
</div>
<!-- 代码部分end -->
</body>
</html>