Rotating Hexagon Loader

Rotating Hexagon Loader – html loader

Source code:

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Rotating Hexagon Loader</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #010910, #094065);
font-family: Arial, sans-serif;
overflow: hidden;
}

/* Loader Container */
.loader-container {
position: relative;
width: 100px;
height: 100px;
}

.hexagon {
position: absolute;
width: 60px;
height: 60px;
background: #FFEB3B;
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
animation: rotateHexagon 1.5s linear infinite;
}

.hexagon::after {
content: ”;
position: absolute;
top: 10px;
left: 10px;
width: 40px;
height: 40px;
background: #F44336;
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* Keyframes for Rotation */
@keyframes rotateHexagon {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

/* Main Content */
.main-content {
display: none;
text-align: center;
color: white;
font-size: 2rem;
animation: fadeIn 1s ease-out forwards;
}

/* Fade-In Animation */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

/* Hide Loader and Show Content */
/* body.loaded .loader-container {
display: none;
}

body.loaded .main-content {
display: block;
}*/
</style>
</head>
<body>
<div class=”loader-container”>
<div class=”hexagon”></div>
</div>

<!– <div class=”main-content”>
Welcome to the main page!
</div> –>
</body>
</html>

Scroll to Top