Unwrap today's treat
Every morning until 24 December, a different discount waits in the parcel. It is valid until midnight.
The code is typed in at the basket step.
A gift box to click: it spins once, its lid and bow lift off, and a golden tag pops out of the box with a bounce and twelve sparks.
Updated
This effect is free — the Hover category contains 49 effects total, including 5 free. Effect.Labs has 846 vanilla effects. Explore the category →
Unwrap today's treat
Every morning until 24 December, a different discount waits in the parcel. It is valid until midnight.
The code is typed in at the basket step.
One seasonal herbal tea, every first Monday
Three parcels, one prize in each. Which one is yours?
One parcel per person · the game closes on Friday at noon
The whole gift is a single 220 × 250 px <button class="guw-gift">. Inside, .guw-inner holds four pieces drawn in CSS: the box (.guw-box), the lid (.guw-lid), the bow (.guw-bow, a 🎀 emoji) and the tag (.guw-code), tucked behind the box and shrunk to 60%. The click does one thing only: it adds or removes the .guw-open class on the button. Everything else is a chain of staggered CSS transitions.
On opening, .guw-inner turns 360° in 0.75 s around a point set at 70% of its height, level with the box. At 0.78 s the lid rises 86 px while tilting 10°, and the bow follows. At 1 s the tag rises 104 px and returns to full size along a curve that overshoots before settling: that is the bounce. At 1.1 s the script adds twelve <span class="guw-spark"> that fan out upwards, 50 to 100 px away, and removes them 0.8 s later.
A second click wraps it again in reverse order, thanks to other delays: the tag goes back at once, the lid drops at 0.55 s, the box spins again at 0.9 s. The tag text comes from data-code on .guw-scene, with a 🎄 in front; without that attribute, the content of .guw-code written in the HTML is kept as is.
Each [data-guw] in the page has its own state: several gifts open separately, and the script adds nothing to window.
aria-hidden), and the tag with it. The revealed text therefore travels two other ways: the button's name, which becomes “Gift opened: NOEL30. Activate to wrap it again.”, and an announcement area (role="status") that says “Gift opened: NOEL30” when the tag pops out. Once closed, the button is “Open the gift” again and the announcement is cleared.#fb7185) only shows for keyboard use, thanks to :focus-visible.prefers-reduced-motion: reduce, the four transitions are cut and the sparks are not created. The box jumps from closed to open, the tag is readable at once and the announcement goes out without waiting.The floor comes from the CSS inset property, which gives .guw-inner its size: Chrome 87, Firefox 66, Safari 14.1. The rest is older: CSS variables for the direction of the sparks (Chrome 49, Firefox 31, Safari 9.1), :focus-visible for the outline (Chrome 86, Firefox 85, Safari 15.4; before that, no outline drawn by the effect). Versions read from @mdn/browser-compat-data.
Without JavaScript, the box stays closed: it is a button named “Open the gift” that does nothing, and the tag is never shown. Do not rely on it for essential information. In a browser without inset, the pieces of the box pile up on each other.
Copy it all in one click, or block by block. No dependencies.
<div class="fx-0812-root">
<div class="guw-scene" data-guw data-code="NOEL30">
<button type="button" class="guw-gift" data-guw-box aria-label="Open the gift">
<span class="guw-inner" aria-hidden="true">
<span class="guw-code" data-guw-code>🎄 NOEL30</span>
<span class="guw-box"></span>
<span class="guw-lid"></span>
<span class="guw-bow">🎀</span>
</span>
</button>
<div class="guw-hint" aria-hidden="true">Click to unwrap</div>
<p class="guw-status" data-guw-status role="status"></p>
</div>
</div>
.fx-0812-root,
.fx-0812-root *,
.fx-0812-root *::before,
.fx-0812-root *::after {
box-sizing: border-box
}
.fx-0812-root {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 200px;
position: relative;
background: rgb(26, 26, 36);
color: rgb(255, 255, 255);
font-family: sans-serif;
}
.guw-scene {
position: relative;
display: grid;
place-items: center;
min-height: 330px;
border-radius: 14px;
overflow: hidden;
background: radial-gradient(circle at 50% 35%, #241433, #0b0a14 72%);
}
.guw-gift {
position: relative;
width: 220px;
height: 250px;
border: 0;
background: none;
cursor: pointer;
outline-offset: 8px;
}
.guw-gift:focus-visible {
outline: 2px solid #fb7185;
border-radius: 12px;
}
.guw-code {
position: absolute;
left: 50%;
bottom: 58px;
transform: translateX(-50%) translateY(0) scale(.6);
z-index: 3;
background: linear-gradient(135deg, #ffe08a, #f2a900);
color: #5b3a00;
font-weight: 800;
letter-spacing: .06em;
font-size: 16px;
padding: 9px 16px;
border-radius: 10px;
white-space: nowrap;
box-shadow: 0 8px 18px rgba(0, 0, 0, .4);
border: 2px dashed #b97e00;
transition: transform .55s cubic-bezier(.2, 1.55, .35, 1);
transition-delay: 0s;
}
.guw-box {
position: absolute;
left: 50%;
bottom: 40px;
transform: translateX(-50%);
width: 140px;
height: 96px;
border-radius: 9px;
z-index: 4;
background: linear-gradient(135deg, #e01e37, #9c0f20);
box-shadow: inset 0 -10px 16px rgba(0, 0, 0, .32), 0 14px 22px rgba(0, 0, 0, .4);
}
.guw-box::before {
content: "";
position: absolute;
left: 50%;
top: 0;
transform: translateX(-50%);
width: 24px;
height: 100%;
background: linear-gradient(#ffd166, #f2a900);
}
.guw-box::after {
content: "";
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
width: 100%;
height: 24px;
background: linear-gradient(90deg, #f2a900, #ffd166);
}
.guw-lid {
position: absolute;
left: 50%;
bottom: 124px;
transform: translateX(-50%) translateY(0) rotate(0);
width: 162px;
height: 40px;
border-radius: 9px;
z-index: 6;
background: linear-gradient(135deg, #f0263f, #b01225);
box-shadow: 0 6px 12px rgba(0, 0, 0, .35);
transition: transform .5s cubic-bezier(.34, 1.3, .5, 1);
transition-delay: .55s;
}
.guw-lid::before {
content: "";
position: absolute;
left: 50%;
top: 0;
transform: translateX(-50%);
width: 24px;
height: 100%;
background: linear-gradient(#ffd166, #f2a900);
}
.guw-bow {
position: absolute;
left: 50%;
bottom: 150px;
transform: translateX(-50%) translateY(0);
font-size: 40px;
z-index: 7;
transition: transform .5s cubic-bezier(.34, 1.3, .5, 1);
transition-delay: .55s;
}
.guw-inner {
position: absolute;
inset: 0;
transform-origin: 50% 70%;
transition: transform .75s cubic-bezier(.45, .05, .2, 1);
transition-delay: .9s;
}
.guw-gift.guw-open .guw-inner {
transform: rotate(360deg);
transition-delay: 0s;
}
.guw-gift.guw-open .guw-lid {
transform: translateX(-50%) translateY(-86px) rotate(-10deg);
transition-delay: .78s;
}
.guw-gift.guw-open .guw-bow {
transform: translateX(-50%) translateY(-76px) rotate(28deg);
transition-delay: .78s;
}
.guw-gift.guw-open .guw-code {
transform: translateX(-50%) translateY(-104px) scale(1);
transition-delay: 1s;
}
.guw-spark {
position: absolute;
width: 9px;
height: 9px;
border-radius: 50%;
background: #ffd166;
z-index: 8;
transform: translate(-50%, -50%);
pointer-events: none;
animation: guw-spark .75s ease-out forwards;
}
.guw-hint {
position: absolute;
bottom: 12px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
color: #fb7185;
opacity: .6;
pointer-events: none;
transition: opacity .3s;
}
.guw-scene.guw-done .guw-hint {
opacity: 0;
}
.guw-status {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
.guw-inner,
.guw-lid,
.guw-bow,
.guw-code {
transition: none !important;
}
}
@keyframes guw-spark {
to {
transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(.2);
opacity: 0;
}
}
(function() {
/* December 2026 sprint — Christmas — Gift Unwrap Reveal (fx-0812) */
(function() {
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
/* Texts read by screen readers; {code} = the revealed text */
var i18n = {
fr: { open: 'Ouvrir le cadeau', opened: 'Cadeau ouvert : {code}. Activer pour le ré-emballer.', said: 'Cadeau ouvert : {code}' },
en: { open: 'Open the gift', opened: 'Gift opened: {code}. Activate to wrap it again.', said: 'Gift opened: {code}' }
};
document.querySelectorAll('[data-guw]').forEach(function(scene) {
var gift = scene.querySelector('[data-guw-box]');
var code = scene.querySelector('[data-guw-code]');
var status = scene.querySelector('[data-guw-status]'); // announcement area (role="status"), optional
if (scene.dataset.code) code.textContent = '🎄 ' + scene.dataset.code;
var open = false,
sayTimer = 0;
/* --- language detection: data-lang > closest lang > html > en --- */
var lang = (scene.getAttribute('data-lang') || (scene.closest('[lang]') || document.documentElement).getAttribute('lang') || 'en').toLowerCase().indexOf('fr') === 0 ? 'fr' : 'en';
var t = i18n[lang];
gift.setAttribute('aria-label', t.open);
function burst() {
if (reduceMotion) return;
for (var i = 0; i < 12; i++) {
var s = document.createElement('span');
s.className = 'guw-spark';
s.style.left = '50%';
s.style.bottom = '150px';
var a = (i / 12) * 6.2832 + Math.random() * 0.4,
d = 50 + Math.random() * 50;
s.style.setProperty('--dx', Math.cos(a) * d + 'px');
s.style.setProperty('--dy', -Math.abs(Math.sin(a) * d) - 10 + 'px');
gift.appendChild(s);
(function(el) {
setTimeout(function() {
el.remove();
}, 800);
})(s);
}
}
function toggle() {
open = !open;
gift.classList.toggle('guw-open', open);
scene.classList.toggle('guw-done', open);
/* The gift drawing is hidden from screen readers (aria-hidden): the revealed text goes through the button's name
and through the announcement area, when it pops out of the box */
var txt = scene.dataset.code || code.textContent.trim();
gift.setAttribute('aria-label', open ? t.opened.split('{code}').join(txt) : t.open);
clearTimeout(sayTimer);
if (status) {
if (open) sayTimer = setTimeout(function() {
status.textContent = t.said.split('{code}').join(txt);
}, reduceMotion ? 0 : 1100);
else status.textContent = '';
}
if (open) setTimeout(burst, reduceMotion ? 0 : 1100);
}
gift.addEventListener('click', toggle);
gift.addEventListener('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
toggle();
}
});
});
})();
})();
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Tag text — data-code on .guw-scene |
NOEL30 | The script writes “🎄” then the value. For another emoji or none, remove data-code and write the text straight into .guw-code. |
Box size — transform: scale() on .guw-gift |
220 × 250 px | The pieces are placed in pixels: for a smaller or larger box, scale the button rather than changing its dimensions. When open, the bow rises about 35 px above the button: keep that margin free. |
Box colour — .guw-box and .guw-lid |
Red, from #e01e37 to #9c0f20 |
Two gradients to change together, the lid one shade lighter than the box. |
Ribbon colour — .guw-box::before, .guw-box::after, .guw-lid::before |
Gold, #ffd166 and #f2a900 |
The three bands of the ribbon. The sparks (.guw-spark) and the tag have their own golden colour, to be matched. |
Sparks — loop of burst() |
12, thrown between 50 and 100 px | Change the 12 of the loop (and the one in the division) for the number, and 50 + Math.random() * 50 for the distance. |
Spin duration — transition of .guw-inner |
0.75 s | If you lengthen it, shift the delays of the lid (0.78 s), the tag (1 s) and the two 1100 in the script (sparks and announcement) by the same amount, otherwise the tag will pop out before the spin ends. |
Texts read by screen readers — i18n object of the script |
English or French depending on the page language | The script picks from data-lang on .guw-scene, otherwise from the closest lang attribute. For another language or wording, edit the three sentences; {code} is replaced by the revealed text. |
Yes: a first name, a prize, a date, a few words. Write them into .guw-code and remove data-code. Two caveats: the tag does not wrap (white-space: nowrap), so keep it short; and since it sits inside a <button>, it can contain neither a link nor another button.
Call .click() on the .guw-gift: that is what the second example does when the form is submitted. To know whether it is already open, check for the guw-open class. Do not set that class yourself: the button's name and the announcement for screen readers would not follow.
Yes. The drawing is hidden, but the script writes the code into the button's name and announces it in [data-guw-status] when the tag pops out. Keep that paragraph in your HTML: without it, the opening is no longer announced, only the button's name changes.