<div class="container">
<div id="top"></div>
<div id="center"></div>
<div id="bottom"></div>
</div>
body{
height: 100vh;
background: linear-gradient(to bottom left, #000000, #262626, #1d1d1d );
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.container{
width: 200px;
height: 180px;
position: relative;
cursor: pointer;
}
#top {
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 36px;
background: linear-gradient(to bottom left,#783b00, #825000, #c15f00);
transition: 1s;
border-radius: 20px 0px 0px 0px;
}
#center {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
width: 100%;
height: 36px;
background: linear-gradient(to bottom left,#783b00, #825000, #c15f00);
transition: 1s;
}
#bottom {
position: absolute;
bottom: 0;
right: 0;
width: 50%;
height: 36px;
background: linear-gradient(to bottom left,#783b00, #825000, #c15f00);
transition: 1s;
border-radius: 0px 0px 20px 0px;
}
.container.active #center {
border-radius: 50%;
background: transparent;
border: 5px solid #c15f00;
width: 50px;
height: 50px;
top: 50%;
left: 50%;
transform: translate(-50%,-50%) scale(6);
}
.container.active #top {
transform: rotate(45deg);
width: 120%;
top: 70px;
left: -20px;
border-radius: 50px;
}
.container.active #bottom {
transform: rotate(-45deg);
width: 120%;
right: -20px;
bottom: 70px;
border-radius: 50px;
}
let box = document.querySelector(".container");
box.addEventListener("click", function () {
box.classList.toggle("active");
document.querySelector("body").classList.toggle("bcolor")
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.