Jon Snow
2023-10-08T10:30:00Z
Glassmorphism Card Hover Effect Tutorial
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Glassmorphism Card</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="card">
<div class="circle"></div>
<div class="circle"></div>
<div class="card-inner"></div>
</div>
</body>
</html>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
background-color: #212121;
margin: 0;
}
.card {
width: 190px;
height: 254px;
position: relative;
cursor: pointer;
transition: all 0.2s;
}
.card-inner {
width: inherit;
height: inherit;
background: rgba(255, 255, 255, 0.05);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(10px);
border-radius: 8px;
}
/* Visit https://democoding.in/ for more free css animation */
.card:hover {
transform: scale(1.04) rotate(1deg);
}
.circle {
width: 100px;
height: 100px;
background: radial-gradient(#b0e633, #53ef7d);
border-radius: 50%;
position: absolute;
animation: move-up 2s ease-in infinite alternate-reverse;
}
.circle:nth-child(1) {
top: -25px;
left: -25px;
}
.circle:nth-child(2) {
bottom: -25px;
right: -25px;
animation: move-down;
}
@keyframes move-up {
to {
transform: translateY(-10px);
}
}
@keyframes move-down {
to {
transform: translateY(10px);
}
}