How to Create 3D Product Reflections & Floor Shadows in CSS
To create glossy Apple-style 3D floor reflections, use -webkit-box-reflect: below 0 linear-gradient(to bottom, transparent 60%, rgba(255,255,255,0.25)) in WebKit/Blink browsers. For universal cross-browser support (including Firefox), render a pseudo-element clone with transform: scaleY(-1), position it beneath the product card, apply an alpha fade via mask-image, and anchor it with a flattened radial-gradient() contact shadow ellipse.
Step 1: The -webkit-box-reflect One-Liner (WebKit & Blink)
In Chromium and Safari browsers, the -webkit-box-reflect property generates a mirror reflection in a single line. It accepts a direction (below, above, left, right), an offset gap, and a gradient mask.
.product-card {
/* Direction: below, Gap: 2px, Gradient fade */
-webkit-box-reflect: below 2px linear-gradient(to bottom, transparent 50%, rgba(255, 255, 255, 0.3));
}
Step 2: Universal Cross-Browser Reflection with transform: scaleY(-1)
Because Firefox does not support -webkit-box-reflect, build a modern cross-browser fallback using a duplicate container or pseudo-element flipped vertically with transform: scaleY(-1) and faded using mask-image.
.product-showcase {
position: relative;
}
.product-reflection {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 50%;
transform: scaleY(-1);
opacity: 0.35;
filter: blur(0.6px);
mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
-webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
pointer-events: none;
}
Step 3: Crafting the 3D Ground Contact Shadow Ellipse
A reflection alone looks ungrounded without a physical contact shadow. Position a flattened ellipse directly at the seam where the product meets the floor plane using CSS radial-gradient(ellipse, ...).
.floor-contact-shadow {
width: 90%;
height: 12px;
margin: 0 auto;
background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, transparent 75%);
filter: blur(2px);
transform: translateY(-6px);
}
Step 4: Interactive Hover Elevation & Dynamic Reflection Fade
When the user hovers over the card, lift the product upward with transform: translateY(-12px) while expanding the contact shadow blur and softening reflection opacity to simulate height off the ground.
.product-showcase:hover .product-card {
transform: translateY(-12px);
transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.product-showcase:hover .floor-contact-shadow {
transform: translateY(0) scale(1.15);
opacity: 0.5;
filter: blur(6px);
transition: all 0.3s ease;
}
Next-Level Addons: Elevating Your Implementation
Take this technique further by combining it with complementary design token studios and animation tools:
A trick I use in almost every project: don't fight specificity battles with !important. Leverage modern CSS cascade layers (@layer) and CSS variables as design tokens—it makes dark/light theme switching and responsive tuning effortless.
Frequently Asked Questions
Practical answers to common implementation questions, browser quirks, and performance tips.
Why does Firefox not support -webkit-box-reflect?
The Firefox team declined to implement `-webkit-box-reflect` because it was never ratified into the official W3C standard. Instead, Firefox adheres to the CSS Masking and CSS Transforms standards, which provide equivalent results via `transform: scaleY(-1)` and `mask-image`.
Can reflections be applied to text elements as well as images?
Yes! Both `-webkit-box-reflect` and the `scaleY(-1)` technique work on arbitrary HTML text headings, buttons, and card containers.
Why should I add a slight blur to the reflected layer?
Real-world polished surfaces (like treated wood, marble, or anodized aluminum) are not 100% perfect mirrors. Adding `filter: blur(0.5px)` or `1px` softens reflection edges and creates convincing physical realism.
How do I ensure the reflection does not block mouse clicks on links underneath?
Always apply `pointer-events: none;` to the reflected pseudo-element or container so user clicks pass right through to underlying elements.
Does creating a reflection duplicate video or canvas rendering load?
With `-webkit-box-reflect`, the browser reuses the existing GPU texture buffer without rendering a second video pipeline. With DOM duplication (`scaleY(-1)`), playing a second video does consume additional decoder resources.