Utilizing a CSS3 Designed Preloader for my website with some unique keyframe animations.
#preloader
{
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
@-webkit-keyframes moveup
{
0%, 60%, 100%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
}
25%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(1em);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(1em);
}
}
@keyframes moveup
{
0%, 60%, 100%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
}
25%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(1em);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(1em);
}
}
@-webkit-keyframes movedown
{
0%, 60%, 100%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
}
25%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(-1em);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(-1em);
}
}
@keyframes movedown
{
0%, 60%, 100%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(0);
}
25%
{
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(-1em);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg) translateZ(-1em);
}
}
.layer
{
display: block;
position: absolute;
height: 3em;
width: 3em;
box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2);
-webkit-transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg);
transform: rotateX(50deg) rotateY(0deg) rotateZ(45deg);
}
.layer:nth-of-type(1)
{
background: #534a47;
margin-top: 1.5em;
-webkit-animation: movedown 1.8s cubic-bezier(0.39, 0.575, 0.565, 1) 0.9s infinite normal;
animation: movedown 1.8s cubic-bezier(0.39, 0.575, 0.565, 1) 0.9s infinite normal;
}
.layer:nth-of-type(1):before
{
content: '';
position: absolute;
width: 85%;
height: 85%;
background: #37332f;
}
.layer:nth-of-type(2)
{
background: #5a96bc;
margin-top: 0.75em;
}
.layer:nth-of-type(3)
{
background: rgba(255, 255, 255, 0.6);
-webkit-animation: moveup 1.8s cubic-bezier(0.39, 0.575, 0.565, 1) infinite normal;
animation: moveup 1.8s cubic-bezier(0.39, 0.575, 0.565, 1) infinite normal;
}
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
</head>
<body>
<!-- THEME PRELOADER AREA -->
<div id="preloader">
<i class='layer'></i>
<i class='layer'></i>
<i class='layer'></i>
</div>
<div class="wrapper">
This is just a demo content placeholder.
</div>
</body>
</html>
The issue I'm encountering is that the preloader is displayed along with the HTML content during site load.
I want to enhance the design by setting the preloader's div background color to white to cover up the loading process and hide the background HTML content until fully loaded.
If anyone has suggestions on achieving this desired effect, please share them!
An added note, I have JavaScript code in place to remove the preloader once the page loads completely; my main concern is addressing the visibility of the background contents during the loading phase.