编写html代码一个从左向右滚动的圆圈同时有一行文字围绕着这个圆圈旋转
<!DOCTYPE html>
<html>
<head>
<title>Scrolling Circle</title>
<style>
.container {
margin: 50px;
position: relative;
width: 400px;
height: 400px;
border: 1px solid black;
overflow: hidden;
}
.circle {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
width: 50px;
height: 50px;
border-radius: 50%;
background-color: red;
animation: scroll 5s linear infinite;
}
.text {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform-origin: center center;
animation: rotate 5s linear infinite;
text-align: center;
font-size: 20px;
font-weight: bold;
line-height: 50px;
}
@keyframes scroll {
0% { left: 0; }
100% { left: 100%; }
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<div class="circle"></div>
<div class="text">This text is rotating around the scrolling circle</div>
</div>
</body>
</html
原文地址: https://www.cveoy.top/t/topic/fk3G 著作权归作者所有。请勿转载和采集!