<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>简单的CSS文字滚动轮播</title>
</head>
<style>
#container {
font-size: 32px;
display:block;
}
#flip {
height:50px;
overflow:hidden;
}
#flip > div > div {
color:black;
padding: 0 18px;
line-height: 45px;
height:45px;
margin-bottom:45px;
display:inline-block;
}
#flip div:first-child {
animation: show 10s linear infinite;
}
@keyframes show {
0% {margin-top:-270px;}
5% {margin-top:-180px;}
33% {margin-top:-180px;}
38% {margin-top:-90px;}
66% {margin-top:-90px;}
71% {margin-top:0px;}
99.99% {margin-top:0px;}
100% {margin-top:-270px;}
}
</style>
<body>
<div id="container">
<div id="flip">
<div><div>1</div></div>
<div><div>2</div></div>
<div><div>3</div></div>
</div>
</div>
</body>
</html>
css文字滚动
最新推荐文章于 2024-04-01 23:44:34 发布