CSS Snippets
Pure CSS Hover Effects
A collection of reusable, dependency-free hover effects built with plain CSS transitions and transforms. Hover any preview to see the effect live, then copy the exact stylesheet that drives it.
Underline Slide
A single underline slides in from the right while the label tints toward the accent color.
/* Underline slide */
.ddk-hover-underline {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #E4E4E7;
background: #27272A;
border-radius: 8px;
cursor: pointer;
user-select: none;
transition: color 0.3s ease;
}
.ddk-hover-underline::after {
content: '';
position: absolute;
left: 14px;
right: 14px;
bottom: 6px;
height: 2px;
background: #A35FFF;
border-radius: 1px;
transform: scaleX(0);
transform-origin: right center;
transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.ddk-hover-underline:hover {
color: #C4B5FD;
}
.ddk-hover-underline:hover::after {
transform: scaleX(1);
transform-origin: left center;
}Lift + Shadow
The element floats upward and casts a soft, accent-tinted shadow beneath it.
/* Lift + shadow */
.ddk-hover-lift {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #E4E4E7;
background: #27272A;
border: 1px solid rgba(255, 255, 255, 0.14);
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.ddk-hover-lift:hover {
transform: translateY(-6px);
border-color: rgba(163, 95, 255, 0.6);
box-shadow: 0 14px 30px -8px rgba(163, 95, 255, 0.45);
}Scale
Grows slightly with a tactile zoom and a deeper accent glow around the edges.
/* Scale */
.ddk-hover-scale {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #FFFFFF;
background: #A35FFF;
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.ddk-hover-scale:hover {
transform: scale(1.08);
box-shadow: 0 8px 24px -6px rgba(163, 95, 255, 0.65);
}Border Glow
The border ignites into an accent outline with a soft outer halo, like a neon edge.
/* Border glow */
.ddk-hover-glow {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #E4E4E7;
background: #27272A;
border: 1px solid rgba(255, 255, 255, 0.14);
border-radius: 8px;
cursor: pointer;
user-select: none;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.ddk-hover-glow:hover {
border-color: #A35FFF;
box-shadow: 0 0 0 1px #A35FFF, 0 0 24px rgba(163, 95, 255, 0.55);
}Gradient Sweep
A purple gradient sweeps across the background while the label brightens to white.
/* Gradient sweep */
.ddk-hover-sweep {
position: relative;
z-index: 0;
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #E4E4E7;
background: #27272A;
border-radius: 8px;
cursor: pointer;
user-select: none;
transition: color 0.35s ease;
}
.ddk-hover-sweep::before {
content: '';
position: absolute;
inset: 0;
z-index: -1;
background: linear-gradient(120deg, #A35FFF 0%, #7C3AED 100%);
transform: translateX(-101%);
transition: transform 0.4s ease;
}
.ddk-hover-sweep:hover {
color: #FFFFFF;
}
.ddk-hover-sweep:hover::before {
transform: translateX(0);
}Shrink
Compresses inward on hover to feel like a tactile press against the surface.
/* Shrink */
.ddk-hover-shrink {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #FFFFFF;
background: #A35FFF;
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.ddk-hover-shrink:hover {
transform: scale(0.92);
box-shadow: 0 1px 4px -2px rgba(163, 95, 255, 0.4);
}Rotate
Tilts and scales with a subtle overshoot for a playful, springy nudge.
/* Rotate */
.ddk-hover-rotate {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #FFFFFF;
background: #A35FFF;
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ddk-hover-rotate:hover {
transform: rotate(6deg) scale(1.06);
}Pulse
A continuous heartbeat while hovered, pulsing scale and glow in a smooth loop.
/* Pulse */
.ddk-hover-pulse {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #FFFFFF;
background: #A35FFF;
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
}
.ddk-hover-pulse:hover {
animation: ddk-hover-pulse 0.8s ease-in-out infinite;
}
@keyframes ddk-hover-pulse {
0%,
100% {
transform: scale(1);
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
}
50% {
transform: scale(1.07);
box-shadow: 0 0 28px rgba(163, 95, 255, 0.7);
}
}Shine Sweep
A glossy light streak sweeps diagonally across the surface on hover.
/* Shine sweep */
.ddk-hover-shine {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 12px 22px;
font-size: 0.9rem;
font-weight: 600;
line-height: 1;
color: #FFFFFF;
background: #A35FFF;
border-radius: 8px;
cursor: pointer;
user-select: none;
box-shadow: 0 4px 14px -4px rgba(163, 95, 255, 0.5);
}
.ddk-hover-shine::after {
content: '';
position: absolute;
top: 0;
left: -80%;
width: 50%;
height: 100%;
background: linear-gradient(
120deg,
transparent,
rgba(255, 255, 255, 0.45),
transparent
);
transform: skewX(-20deg);
transition: left 0.55s ease;
}
.ddk-hover-shine:hover::after {
left: 130%;
}