Skip to content

Instantly share code, notes, and snippets.

@Sh00k-ThaD3v
Created February 2, 2023 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sh00k-ThaD3v/18d7640a9e667aa696f68b5afb763136 to your computer and use it in GitHub Desktop.
Save Sh00k-ThaD3v/18d7640a9e667aa696f68b5afb763136 to your computer and use it in GitHub Desktop.
Pure CSS Split Screen Loader
<div class="container">
<div class="split-screen"></div>
<div class="background-image"></div>
<div class="content">
<p>Hello <span class="comma">,</span></p>
<p>World</p>
</div>
</div>
@import url("https://fonts.googleapis.com/css?family=Montserrat:900");
body {
margin: 0;
box-sizing: border-box;
overflow: hidden;
font-family: "Montserrat", sans-serif;
background-color: #b1bcbf;
}
.container {
width: 100%;
height: 100vh;
position: relative;
}
.background-image {
width: 50%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
margin: auto;
background-image: url("https://images.pexels.com/photos/1261728/pexels-photo-1261728.jpeg");
background-size: cover;
}
.split-screen {
width: 100%;
background-color: #2c2d2b;
position: absolute;
left: 0;
top: 0;
bottom: 0;
z-index: 2;
animation:
reduceSize 1.5s 0.5s,
moveRight 1.5s 3s;
animation-fill-mode: forwards;
}
.content {
color: white;
font-size: 10vw;
text-transform: uppercase;
position: absolute;
width: fit-content;
height: fit-content;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
z-index: 4;
opacity: 0;
transform: translateY(100vh);
animation:
fadeInUp 2s 0.5s,
moveRight 1.5s 3s,
changeBackground 1.5s 3s;
animation-fill-mode: forwards;
}
.content p {
margin: 0;
}
.content .comma {
color: #2c2d2b;
opacity: 1;
animation: fadeOut 0.5s forwards 2.5s;
}
@keyframes reduceSize {
from {
width: 100%;
}
to {
width: 50%;
}
}
@keyframes fadeInUp {
from {
transform: translateY(100vh);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes moveRight {
from {
left: 0%;
}
to {
left: 50%;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes changeBackground {
to {
background-image: url("https://images.pexels.com/photos/1261728/pexels-photo-1261728.jpeg");
background-size: 200%;
background-position: center;
background-clip: text;
-webkit-background-clip: text;
color: transparent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment