Create Image Reflections Easily with CSS3’s box‑reflect Property

This guide explains how CSS3’s box‑reflect property lets you add realistic reflection effects to images and other elements using simple syntax, covering direction, offset, mask options, step‑by‑step examples, gradient and image masks, and browser compatibility.

Tencent IMWeb Frontend Team
Tencent IMWeb Frontend Team
Tencent IMWeb Frontend Team
Create Image Reflections Easily with CSS3’s box‑reflect Property

Before CSS3, creating a reflection effect required editing the image itself; with CSS3 the box‑reflect property makes it trivial.

Syntax

box‑reflect : none | <direction> <offset>? <mask‑box‑image>? (the last two values are optional) <direction> = above | below | left | right <offset> = <length> | <percentage> <mask‑box‑image> = none | <url> | <linear‑gradient> | <radial‑gradient> | <repeating‑linear‑gradient> | <repeating‑radial‑gradient> Default : none

The property can be set to none (no reflection) or a combination of direction, offset, and an optional mask image. If a mask is provided, the offset becomes mandatory.

Step‑by‑step examples

1. Simple reflection below the element

Result:

2. Add a 5px offset

Result:

3. Apply a gradient mask

Result:

These effects work not only on images but also on other elements such as text.

Radial gradient mask and image mask

Radial gradients are used similarly to linear gradients. Example:

Result:

Using an image as a mask:

Result:

Compatibility : The box‑reflect property is currently supported only by WebKit‑based browsers, but mobile browsers generally have no issues.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

frontendcss3box-reflectgradient maskimage reflection
Tencent IMWeb Frontend Team
Written by

Tencent IMWeb Frontend Team

IMWeb Frontend Community gathering frontend development enthusiasts. Follow us for refined live courses by top experts, cutting‑edge technical posts, and to sharpen your frontend skills.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.