a CSS animation where the text scrolls vertically in an infinite loop and fades in and out.
Created
August 6, 2024 06:02
-
-
Save deanh/a7cce9d85c81d84aa1bc3bbf510cf81a to your computer and use it in GitHub Desktop.
Vertical scrolling text CSS animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id ="two"> | |
<p>I speak</p> | |
<div class="box"> | |
<ul> | |
<li class="item-1">English</li> | |
<li class="item-2">Maltese</li> | |
<li class="item-3">Danish</li> | |
<li class="item-4">Italian</li> | |
<li class="item-5">English</li> | |
</ul> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
height: 100vh; | |
} | |
#two { | |
background: #ff8e71; | |
height: 100%; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
font-size: 30px; | |
color: #ebd8d0; | |
} | |
.box { | |
height: 40px; | |
overflow: hidden; | |
position: relative; | |
} | |
.box::before { | |
top: 0; | |
left: 0; | |
z-index: 1; | |
width: 100%; | |
content: ''; | |
height: 10px; | |
position: absolute; | |
background: linear-gradient(180deg, #ff8e71, rgba(255, 142, 113, 0)); | |
} | |
.box::after { | |
left: 0; | |
bottom: 0; | |
z-index: 1; | |
width: 100%; | |
content: ''; | |
height: 10px; | |
position: absolute; | |
background: linear-gradient(180deg, rgba(255, 142, 113, 0), #ff8e71); | |
} | |
p { | |
float: left; | |
} | |
ul { | |
float: right; | |
margin: 0; | |
padding: 0; | |
-webkit-animation: scrollUp 4s ease-in-out infinite normal; | |
animation: scrollUp 4s ease-in-out infinite normal; | |
} | |
ul li { | |
opacity: 1; | |
height: 20px; | |
padding: 10px; | |
list-style: none; | |
} | |
@-webkit-keyframes scrollUp { | |
from { | |
-webkit-transform: translateY(0); | |
transform: translateY(0); | |
} | |
to { | |
-webkit-transform: translateY(-80%); | |
transform: translateY(-80%); | |
} | |
} | |
@keyframes scrollUp { | |
from { | |
-webkit-transform: translateY(0); | |
transform: translateY(0); | |
} | |
to { | |
-webkit-transform: translateY(-80%); | |
transform: translateY(-80%); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment