SVG✨ Premium

Diagonal Clip

Two layers that sweep across the card diagonally from the bottom-left corner and leave it split in two tones, each with its own content.

CSSClip-pathLayers

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

Recipe grid: prep time and “See the recipe” arrive diagonally — Diagonal Clip example 1

① Recipe grid: prep time and “See the recipe” arrive diagonally

WhenA seasonal cooking blog's November page: one large card (squash soup) and two small ones (leek tart, poached pears). Hovering a photo brings a green sheet up from the bottom-left corner with the time and difficulty, then an orange triangle settles bottom-right with “See the recipe →”.
WhyPhotos stay bare while you scan the grid; practical details and the call to action only arrive on the dish you care about, each in its own corner, without clashing.
SettingsThe root works as a grid (248 px + the rest, two rows). .dgc-card on each <a> link, --dgc-w:100%, --dgc-h:100%, --dgc-radius:12px, --dgc-layer-1:linear-gradient(135deg,#24483b,#3c7058), --dgc-layer-2:linear-gradient(135deg,#f2a65a,#d9572b), --dgc-pad:14px. Dish photo as an SVG .dgc-media in the face, layers set to aria-hidden.
Bike configurator: the sweep covers the step card when “Next step” is clicked — Diagonal Clip example 2

② Bike configurator: the sweep covers the step card when “Next step” is clicked

WhenA four-step configurator (frame, wheels, colour, summary). On “Next step”, the card is covered diagonally with the name of the coming step; under that curtain the page swaps the content, then the sweep withdraws and uncovers the new step.
WhyMoving between steps feels like a real page change, clear and quick, without content jumping in front of the user's eyes.
Settings.dgc-card.dgc-manual, 100% × 206 px, --dgc-layer-1:linear-gradient(135deg,#0f3d3e,#14746f), --dgc-layer-2:linear-gradient(135deg,#c6f432,#7bd389), --dgc-pad:20px. The page script sets .dgc-open, changes the step 780 ms later (0.6 s sweep + 0.1 s delay) and removes the class. In the capture, the page clicks “Next step” by itself every 2.6 s.
Annual report contents: each row swept in two tones — Diagonal Clip example 3

③ Annual report contents: each row swept in two tones

WhenThe opening page of a foundation's annual report: cover on the left, seven chapters on the right. Moving over a row sweeps it in teal then coral; number, title and page stay in place and change colour on either side of the diagonal.
WhyA contents row is long and thin: the diagonal becomes almost horizontal, which gives the targeted row a bold graphic signature without moving the text.
SettingsOne root for the seven links, --dgc-w:100%, --dgc-h:33px, --dgc-radius:6px, --dgc-front:transparent, --dgc-pad:0, --dgc-speed:.45s, --dgc-delay:.06s. The row content is repeated identically in the face and both layers (layers set to aria-hidden), dark text in the second one. In the capture, the hover is replayed row after row with .dgc-open, on top of the real mouse.

How it works

Under the .dgc-front face, the .dgc-card stacks two .dgc-layer layers. At rest, the four points of each clip-path: polygon() sit together in the bottom-left corner: nothing shows. On opening, the first layer stretches until it covers the whole card, in 0.6 s with the cubic-bezier(.4,0,.2,1) curve: a slanted sweep starting from the bottom-left corner. The second one, .dgc-layer-2, starts 0.1 s later from the same corner and stops on the lower-right triangle. The card ends up split along its diagonal: first layer top-left, second bottom-right.

Each layer's content follows that split: the first one's is anchored top-left, the second one's bottom-right, with a --dgc-pad margin (1 rem). Two pieces of information fit without overlapping: a title and an action, a time and a link. An image or SVG with the .dgc-media class fills the face or a layer.

Triggers: hover on devices that hover (@media (hover: hover)), keyboard focus on the card or an element inside it, and the .dgc-open class, which the script toggles on each tap on touch screens (a tapped link or button keeps its action). With .dgc-manual on the card, hover, focus and tap are ignored: the sweep only happens when your script sets .dgc-open, which turns it into a transition curtain between two states.

Accessibility

  • Keyboard: on Tab the demo card (tabindex="0") gets covered as on hover, with a #f0abfc outline. A card that is a link or button needs no tabindex.
  • Screen readers: layers stay in the page and their text is read after the face. When they repeat the face (a doubled contents row) or are only a transition backdrop, put aria-hidden="true" on each .dgc-layer.
  • Reduced motion: under prefers-reduced-motion: reduce the sweep and its delay are removed: both layers appear together, already in place.
  • Touch: one tap starts the sweep, the next removes it; no more hover state stuck after the finger.

Browser compatibility

Measured in Chromium 151, Firefox 153 and Playwright's WebKit 26.5: 0 errors, two independent copies, sweep on hover, Tab and tap (2nd tap removes it), final state at once with reduced motion, nothing overflowing at 390 px. :focus-visible and :has() set the minimum versions.

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)

Before those versions, hover, tap and the .dgc-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 triggers the sweep.

The code

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

index.html — structure
<div class="fx-0628-root">
  <div class="dgc-card" tabindex="0">
    <span class="dgc-front">Hover</span>
    <div class="dgc-layer">
      <span>Layer 1</span>
    </div>
    <div class="dgc-layer dgc-layer-2">
      <span>Layer 2</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
--dgc-w and --dgc-h 280px and 180px Card size (width capped by the container).
--dgc-radius 1rem Corner rounding.
--dgc-front and --dgc-front-color #1a1a24 and #fff Background and text of the face shown at rest.
--dgc-layer-1 linear-gradient(135deg,#6366f1,#d946ef) Background of the first layer, the one that covers the whole card.
--dgc-layer-2 and --dgc-layer-color linear-gradient(135deg,#d946ef,#f43f5e) and #fff Background of the lower-right triangle, and text colour of both layers.
--dgc-pad 1rem Margin of each layer's content in its corner (0 if that content handles its own layout).
--dgc-speed and --dgc-delay .6s and .1s Sweep duration and the second layer's delay.
--dgc-bg and --dgc-min-h #0a0a0f and 300px Root background and minimum height.
.dgc-open and .dgc-manual classes absent .dgc-open starts the sweep (tap or script). .dgc-manual turns off hover, focus and tap so only your script drives it.

FAQ

Add dgc-manual to the card, then: set dgc-open, wait for the sweep to finish (duration + delay, 700 ms by default), replace the content of .dgc-front, remove dgc-open. The layers withdraw and uncover the new content.
Because the card ends up cut along its diagonal: centred text would straddle both layers and be half covered. The first layer shows its content top-left, the second bottom-right. For text that runs across the whole card, repeat it identically in the face and both layers with --dgc-pad:0, as in the contents example.
Yes, by changing the start and end polygons in the CSS: the starting point 0 100% (bottom-left corner) becomes, say, 100% 0 to start from the top-right corner, and the second layer's final triangle is then written polygon(0 0, 100% 0, 0 100%, 0 100%).