<div class="button">Hover Me (^_^)!!!</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #222;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5rem;
gap: 10px;
}
@property --hue {
syntax: "<integer>";
inherits: true;
initial-value: 0;
}
:root {
--bg: #1a1a1a;
--button-bg: #000;
}
body {
transform-style: preserve-3d;
perspective: 800px;
}
.button {
--border: hsl(var(--hue, 0), 0%, 50%);
--shadow: hsl(var(--hue, 0), 0%, 80%);
user-select: none;
font-size: 2rem;
padding: 1.25rem 2.5rem;
border-radius: 0.5rem;
border: 0.25rem solid;
color: #fff;
cursor: pointer;
outline: transparent;
background: var(--button-bg);
border-color: var(--border);
box-shadow: 0 1rem 2rem -1.5rem var(--shadow);
transition: transform 0.2s, box-shadow 0.2s;
}
.button:hover {
--border: hsl(var(--hue, 0), 80%, 50%);
--shadow: hsl(var(--hue, 0), 80%, 50%);
animation: hueJump 0.75s infinite linear;
transform: rotateY(10deg) rotateX(10deg);
}
.button:active {
transform: rotateY(10deg) rotateX(10deg) translate3d(0, 0, -15px);
box-shadow: 0 0rem 0rem 0rem var(--shadow);
animation-play-state: paused;
}
@keyframes hueJump {
to {
--hue: 360;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.