Gradients, Layered Elevation, Glassmorphism & CSS Filter Playground
CSS Gradients render smooth transitions between colors without bitmap assets.
Achieved using a pseudo-element with inset: -3px; and a vibrant gradient background sitting behind the card body.
.linear { background: linear-gradient(135deg, #667eea, #764ba2); }
.radial { background: radial-gradient(circle at center, #f59e0b, #dc2626); }
.conic { background: conic-gradient(from 0deg, red, yellow, green, cyan, blue, red); }
Notice the vital difference below: box-shadow casts a shadow on the rectangular bounding box, whereas filter: drop-shadow() traces the exact non-transparent contours of the SVG / PNG!
/* Bad for transparent icons: shadows rectangle */
.icon { box-shadow: 10px 10px 15px rgba(0,0,0,0.4); }
/* Best for transparent icons: shadows contour! */
.icon { filter: drop-shadow(10px 10px 10px rgba(0,0,0,0.4)); }
Combine semi-transparent backgrounds with backdrop-filter: blur(14px); to create realistic frosted glass UI panels.
Background elements are dynamically blurred behind this container.
.glass-card {
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
Click the buttons below to apply hardware-accelerated CSS filters directly to the OpenMoji illustration!
.target { filter: none; }
mask-image: Apply alpha masks using gradients to create smooth fade-out edges.
oklch(): Perceptually uniform color space where hue changes preserve constant perceived luminance.
Using mask-image: linear-gradient(to bottom, black 50%, transparent 100%) gracefully fades out overflowing content at the bottom without needing absolute positioned gradient overlays!
/* Fade-out alpha mask */
.fade-box {
mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}
/* Modern perceptually uniform colors */
.swatch {
background-color: oklch(0.65 0.24 140); /* Lightness, Chroma, Hue */
}