css3 跑馬燈 首尾相接效果 不限制字型長短
阿新 • • 發佈:2019-01-11
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.scroll-area {
position: relative;
height: 40px;
border: 0px solid #ccc;
width: 100px;
overflow: hidden;
}
.scroll {
position : absolute;
line-height: 40px;
left: 100%;
top: 0;
white-space: nowrap;
-webkit-animation: todayScroll 4s linear infinite;
animation: todayScroll 4s linear infinite;
}
.today-scroll-content {
margin-right: 3em;
}
@keyframes todayScroll {
0% {
transform : translate(-50%);
}
100% {
transform: translate(-100%);
}
}
</style>
</head>
<body>
<div class="scroll-area">
<div class="scroll">
<span class="today-scroll-content">
的英文這一個跑馬燈
</span>
<span class ="today-scroll-content">
的英文這一個跑馬燈
</span>
</div>
</div>
</body>
</html>
他的程式碼不對,效果和程式碼不匹配,檢視其原始碼,如上;