CSS used in this demo
body {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
}
.container {
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
width: min(90vw, 680px);
height: 30vh;
min-height: 420px;
margin: 15vh auto;
border-radius: 28px;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.box {
border-radius: 20px;
width: 60px;
height: 60px;
background: #f0f0f0;
box-shadow: 0 0 0 rgba(15, 23, 42, 0),
0 0 0 rgba(15, 23, 42, 0),
10px 10px 14px rgba(15, 23, 42, 0.22) inset,
-10px -10px 14px rgba(15, 23, 42, 0.08) inset;
animation: anime 3s cubic-bezier(0.16, 1, 0.3, 1) 1s infinite alternate;
}
@keyframes anime {
0% {
width: 60px;
height: 60px;
background: #f0f0f0;
box-shadow: 0 0 0 rgba(15, 23, 42, 0),
0 0 0 rgba(15, 23, 42, 0),
10px 10px 14px rgba(15, 23, 42, 0.22) inset,
-10px -10px 14px rgba(15, 23, 42, 0.08) inset;
}
25% {
width: 60px;
height: 60px;
background: #f8f8f8;
box-shadow: 10px 10px 18px rgba(15, 23, 42, 0.22),
-10px -10px 18px rgba(15, 23, 42, 0.08),
0 0 0 rgba(15, 23, 42, 0) inset,
0 0 0 rgba(15, 23, 42, 0) inset;
}
50% {
width: 60px;
height: 240px;
background: #f8f8f8;
box-shadow: 10px 10px 18px rgba(15, 23, 42, 0.22),
-10px -10px 18px rgba(15, 23, 42, 0.08),
0 0 0 rgba(15, 23, 42, 0) inset,
0 0 0 rgba(15, 23, 42, 0) inset;
}
100% {
width: 480px;
height: 240px;
background: #fafafa;
box-shadow: 40px 40px 48px rgba(15, 23, 42, 0.24),
-8px -8px 24px rgba(15, 23, 42, 0.08),
0 0 0 rgba(15, 23, 42, 0) inset,
2px 2px 2px rgba(15, 23, 42, 0.08) inset;
}
}