Skip to content

Instantly share code, notes, and snippets.

@deanh
Created August 6, 2024 06:02
Show Gist options
  • Save deanh/a7cce9d85c81d84aa1bc3bbf510cf81a to your computer and use it in GitHub Desktop.
Save deanh/a7cce9d85c81d84aa1bc3bbf510cf81a to your computer and use it in GitHub Desktop.
Vertical scrolling text CSS animation
<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>
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%);
}
}

Vertical scrolling text CSS animation

a CSS animation where the text scrolls vertically in an infinite loop and fades in and out.

A Pen by cschembri on CodePen.

License.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment