SVG✨ Premium

Split Reveal

Two panels that fold back to the edges and uncover the content in the middle: on hover, on focus, on tap, or when your script says so.

CSSClip-pathSplit

Updated

This effect is part of Effect.Labs — 840 vanilla effects, some free, some premium. SVG has 30 effects, including 3 free. Explore the category →

3 usage examples

A hotel room page: the photo's curtains open onto the sea view — Split Reveal example 1

① A hotel room page: the photo's curtains open onto the sea view

WhenThe booking page of a seaside hotel: the room photo on the left, curtains drawn; size, amenities and price on the right. On hover, the two curtain panels fold back to the sides and reveal the bay, the sailing boat and the balcony, with a “Sea view” label.
WhyThe view is what sells the room: uncovering it by opening curtains mirrors what guests will do on arrival, and makes them want this room rather than another.
Settings--spr-w:236px, --spr-h:100%, --spr-radius:12px, --spr-left and --spr-right as a teal repeating-linear-gradient (the folds) under a shadow, view drawn as an SVG .spr-media inside .spr-center.
A tea gift box: the button opens like a lid onto “add to basket” — Split Reveal example 2

② A tea gift box: the button opens like a lid onto “add to basket”

WhenThe page of a box of six loose-leaf teas. The button looks like the box lid, dark green with a gold ribbon in the middle and “Open the box” on either side. On hover, the two halves of the lid part and uncover “Add to basket · €39” on a cream background.
WhyThe button tells the product's story before selling it: opening the lid is already the gift gesture, and the price only shows when you are about to click.
Settings.spr-card on a <button type="button">, 100% × 54 px, --spr-radius:10px, --spr-center:#f3e7c9, --spr-center-color:#1d2a22. The same lid SVG sits in both panels with .spr-media: it reads as one piece at rest, ribbon in the middle, then splits in two.
Quiz: after “Check”, the panels part onto the explanation — Split Reveal example 3

③ Quiz: after “Check”, the panels part onto the explanation

WhenA solar-system quiz question, three answers and a “Check” button. Under the question, a closed band reads “Explanation | after checking”. When the player checks, the right answer turns green and the panels part onto the explanation: Uranus spins almost on its side, its axis tilted by about 98°.
WhyThe explanation is there from the start but stays closed until the answer: players cannot cheat with a hover, and the opening clearly marks the move from question to correction.
Settings.spr-card.spr-manual (no hover, focus or tap), 100% × 68 px, purple gradient panels, --spr-center:#f4f1ff. The page script sets .spr-open when “Check” is clicked. In the capture, the capture mouse's click does the checking.

How it works

The .spr-card holds three layers: .spr-center, the content to uncover, then two panels, .spr-left and .spr-right, each covering one half. The panels are cut by clip-path: polygon(…). On opening, the left panel shrinks towards the left edge and the right one towards the right edge, in 0.5 s with the cubic-bezier(.4,0,.2,1) curve: the centre appears as if between two doors. The panels don't slide, they fold back; their content is cropped in place.

Every layer takes your content. An image or SVG with the .spr-media class fills .spr-center. Inside the panels, the same class makes the image twice as wide as the panel, anchored left in the left panel and right in the right panel: put the same image in both and it looks like one piece at rest, then splits in two when opening.

Triggers: hover (only on devices that hover, @media (hover: hover)), keyboard focus on the card or an element inside it, and the .spr-open class. On touch screens a tap toggles it (opens, then closes on the next tap); a link or button tapped inside the card keeps its action. Add .spr-manual to the card to switch off hover, focus and tap: it then only opens when your script sets .spr-open, for instance after an answer has been checked.

Accessibility

  • Keyboard: the demo card (tabindex="0") opens on Tab with a #c4b5fd outline. On a <button> or <a>, drop tabindex. A .spr-manual card does not need to be focusable: the button that sets the class is.
  • Screen readers: the centre content is always in the page and read, even with the panels closed. Decorative panels (or panels repeating an image) get aria-hidden="true". For a quiz answer, announce the result in an aria-live region of your page: the panels opening cannot be heard.
  • Reduced motion: under prefers-reduced-motion: reduce the panels vanish at once and the centre shows whole, with no animation.
  • Touch: one tap opens, a second one closes; hover no longer gets “stuck” after a tap.

Browser compatibility

Measured in Chromium 151, Firefox 153 and Playwright's WebKit 26.5: 0 errors, two independent copies, opens on hover, Tab and tap (2nd tap closes, also when the code is pasted twice), final state at once with reduced motion, nothing overflowing at 390 px. Minimum versions come from :focus-visible and :has().

Chrome 105+✓ Full (measured)
Firefox 121+✓ Full (measured)
Safari 15.4+✓ Full (measured in Playwright's WebKit)
Edge 105+✓ Full (Chromium engine)
Safari iOS 15.4+✓ Tap checked in emulation, not on a real device
Chrome Android 105+✓ Full (Chromium engine, tap checked in emulation)

Older browsers: hover, tap and the .spr-open class work in older versions that have the inset property (Chrome 87, Firefox 66, Safari 14.1: the versions that brought the inset property used to stack the faces); keyboard focus no longer opens the card. Without JavaScript only the tap is missing.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0626-root">
  <div class="spr-card" tabindex="0">
    <span class="spr-center">CENTER</span>
    <div class="spr-left">
      <span>LEFT</span>
    </div>
    <div class="spr-right">
      <span>RIGHT</span>
    </div>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
--spr-w 280px Card width, capped by its container.
--spr-h 180px Card height.
--spr-radius 1rem Corner rounding.
--spr-center and --spr-center-color #1a1a24 and #fff Background and text of the uncovered content.
--spr-left linear-gradient(135deg,#6366f1,#8b5cf6) Left panel background (colour, gradient, pattern).
--spr-right linear-gradient(135deg,#d946ef,#f43f5e) Right panel background. Give it the same value as the left one for a single colour split down the middle.
--spr-speed .5s Opening and closing time.
--spr-bg and --spr-min-h #0a0a0f and 300px Root background and minimum height (transparent and 0 inside a page).
.spr-open and .spr-manual classes absent .spr-open opens the card (set on tap, or by your script). .spr-manual leaves opening to your script alone.

FAQ

Put the same image in both panels: <img class="spr-media" src="cover.jpg" alt=""> inside .spr-left and inside .spr-right. It becomes twice the panel's width, anchored on the right side: at rest you see a single photo; when opening, each half goes its own way. Leave the alt text empty on these copies (and aria-hidden on the panels).
Add spr-manual to the card so it ignores hover and focus, then in your click handler: card.classList.add('spr-open'). Remove the class to close.
Not without changing the effect: the panels sit left and right and their polygons fold horizontally. For a vertical opening you would place the panels at the top and bottom (height: 50%) and make their polygons fold upwards and downwards.