<div class="container">
<div class="text" data-msg="CSS Animation">
<div class="text--content">
<div class="text--data">CSS Animation</div>
</div>
</div>
</div>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container {
width: 100vw;
min-height: 100vh;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background-color: crimson;
}
.text {
position: relative;
font-size: 40px;
text-transform: uppercase;
letter-spacing: 3px;
line-height: 100%;
color: #fff;
}
.text::before {
content: attr(data-msg);
filter: blur(3px);
}
.text::after {
content: "";
position: absolute;
top: -4px;
left: 0;
width: 50px;
height: calc(100% + 4px);
border-top: 2px solid #fff;
border-bottom: 2px solid #fff;
animation: moveLeft 3s linear infinite alternate;
}
.text--content {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 50px;
overflow: hidden;
background-color: crimson;
animation: moveLeft 3s linear infinite alternate;
}
.text--data {
animation: moveRight 3s linear infinite alternate;
}
@keyframes moveLeft {
0% {
transform: translateX(0px);
}
100% {
transform: translateX(300px);
}
}
@keyframes moveRight {
0% {
transform: translateX(0px);
}
100% {
transform: translateX(-300px);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.