编写html代码一个从左向右滚动的圆圈同时有文字围绕着这个圆圈的外围轨迹旋转
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Scrolling Circle</title>
<style>
.container {
position: relative;
width: 500px;
height: 500px;
margin: 0 auto;
overflow: hidden;
}
.circle {
position: absolute;
top: 50%;
left: -100px;
width: 200px;
height: 200px;
border-radius: 50%;
background-color: red;
animation: scrollCircle 5s linear infinite;
transform: translateY(-50%);
}
.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20px;
animation: rotateText 5s linear infinite;
text-align: center;
width: 200px;
height: 200px;
line-height: 200px;
}
@keyframes scrollCircle {
from { left: -100px; }
to { left: 600px; }
}
@keyframes rotateText {
from { transform: translate(-50%, -50%) rotate(0deg); }
to { transform: translate(-50%, -50%) rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<div class="circle"></div>
<div class="text">Hello, World!</div>
</div>
</body>
</html
原文地址: https://www.cveoy.top/t/topic/fk3T 著作权归作者所有。请勿转载和采集!