62 lines
1.7 KiB
HTML
62 lines
1.7 KiB
HTML
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>纯css实现文字循环滚动效果</title>
|
|
<style type="text/css">
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.box {
|
|
width: 300px;
|
|
margin: 0 auto;
|
|
position: relative;
|
|
border: 1px solid #ff6700;
|
|
}
|
|
|
|
.animate {
|
|
padding-left: 20px;
|
|
font-size: 12px;
|
|
color: #000;
|
|
white-space: nowrap;
|
|
display: inline-block;
|
|
animation: 15s wordsLoop linear infinite normal;
|
|
}
|
|
|
|
@keyframes wordsLoop {
|
|
0% {
|
|
transform: translateX(0px);
|
|
-webkit-transform: translateX(0px);
|
|
}
|
|
100% {
|
|
transform: translateX(-100%);
|
|
-webkit-transform: translateX(-100%);
|
|
}
|
|
}
|
|
|
|
@-webkit-keyframes wordsLoop {
|
|
0% {
|
|
transform: translateX(0px);
|
|
-webkit-transform: translateX(0px);
|
|
}
|
|
100% {
|
|
transform: translateX(-100%);
|
|
-webkit-transform: translateX(-100%);
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="box">
|
|
<p class="animate">
|
|
君不见黄河之水天上来,奔流到海不复回,君不见高堂明镜悲白发,朝如青丝暮成雪,人生得意须尽欢,莫使金樽空对月
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|