记录一下,方便查看
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>字符串滚动循环</title>
<style>
#scroll-container {
overflow: hidden;
white-space: nowrap;
position: relative;
height: 30px;
}
.scroll-text {
display: inline-block;
position: absolute;
animation: scroll 3s linear infinite;
color: #000;
}
@keyframes scroll {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-100%);
}
}
</style>
</head>
<body>
<div id="scroll-container">
<span class="scroll-text">Hello, world!</span>
</div>
</body>
</html>