Cards✨ Premium

Shape-Aware Shadows

box-shadow, border, and outline hug clip-path polygons via border-shape — pointed tag, notched ticket, chat bubble — with universal drop-shadow fallback.

CSSborder-shapeCutting-edge

You'll get access to the interactive demo with a free account.

This effect is part of Effect.Labs — 811 vanilla effects, some free, some premium. Cards has 41 effects, including 6 free. Explore the category →

3 usage examples

🎈

① Promotional badge on a SaaS pricing card

WhenA pricing grid displays a '-40%' or 'New' badge on a plan — floating in the card corner or pinned to the edge.
WhyA pointed tag demands a shadow consistent with its arrow: clip-path alone leaves a rectangular shadow bleeding past the shape. border-shape aligns the shadow and border to the exact polygon, with no hack or extra SVG.
Settingsclip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 50%), hover box-shadow: 0 24px 44px rgba(124,58,237,.5), border: 1.5px solid rgba(255,255,255,.35).
🎊

② Testimonial bubbles on a sales page

WhenA customer review section displays chat bubbles with a directional tail — the layout must hold on both dark and light backgrounds.
WhyThe bubble tail is cut by clip-path; without border-shape, the rectangular shadow betrays the shape. With border-shape, the shadow hugs the tail and the card looks like a real chat message.
Settingsclip-path: polygon(0 0, 100% 0, 100% 78%, 34% 78%, 18% 100%, 22% 78%, 0 78%), background: linear-gradient(160deg, #14b8a6, #0e7490), box-shadow: 0 10px 26px rgba(0,0,0,.55).

③ VIP ticket hero on an event website

WhenA concert, festival, or conference homepage features an oversized styled ticket — the lateral notch visually marks the stub / body separation.
WhyThe notches are created by clip-path; border-shape makes the border and box-shadow follow the notch curves, rendering the ticket visually true to a real ticket and clean on hover.
Settingsclip-path: polygon(0 0, 100% 0, 100% 38%, 96% 50%, 100% 62%, 100% 100%, 0 100%, 0 62%, 4% 50%, 0 38%), box-shadow: 0 12px 36px rgba(43,58,143,.6), border: 1.5px solid rgba(255,255,255,.22).

How it works

The classic clip-path problem: the cut looks perfect, but box-shadow and border stay rectangular — the shadow bleeds outside the cut edges or disappears into the clipped zones. border-shape fixes this by redefining the CSS box model: the border, shadow, and outline follow the declared polygon as if the clipped shape were the box itself.

The effect defines three shapes via clip-path: polygon(…) on the .bsc-card--tag, .bsc-card--ticket, and .bsc-card--bubble variants. In supporting browsers — detected by @supports (border-shape: polygon(…))clip-path is cleared and replaced by border-shape with the same polygon. border and box-shadow then follow the exact geometry: a rim on the tag arrow, a shadow hugging the ticket notches, a drop beneath the bubble tail.

The fallback lives on the base .bsc-card rule: filter: drop-shadow() already follows the clip-path contour natively in all browsers. Inside the @supports block, filter is cleared (filter: none) to hand off to native box-shadow — a clean handoff with no double shadow. No JS errors, no visible degradation on Firefox or Safari.

The JS bound to #bscTag demonstrates the mechanic live: a click cycles through three polygons in the shapes[] array (left arrow, right arrow, rectangle) and updates either clipPath or borderShape depending on detected support. The shadow and border recalculate their geometry instantly — which is impossible to achieve with clip-path alone.

Accessibility

  • prefers-reduced-motion: present in the CSS — transition: none and transform: none on hover cancel all animation when the OS signals a reduced-motion preference.
  • The #bscTag button is a native <button> with aria-label="Carte étiquette — cliquer pour changer de forme" — activatable by keyboard (Enter/Space), in the normal tab order.
  • :focus-visible applies a purple 2px solid #a78bfa outline with outline-offset: 4px on all focusable .bsc-card elements.
  • Text contrast: white on the tag's purple gradient (#7c3aed → #db2777) reaches a ratio ≥ 5.5:1 — WCAG AA compliant.
  • The ticket and bubble variants are non-interactive <div> elements — no additional role or tabindex needed; only the tag (native button) is interactive.

Browser compatibility

border-shape is a cutting-edge CSS property detected by @supports. The drop-shadow + clip-path fallback covers all modern browsers without errors.

Chrome 135+✓ Full (border-shape)
Firefox 130+✓ Fallback drop-shadow
Safari 18+✓ Fallback drop-shadow
Edge 135+✓ Full (border-shape)
Mobile iOS✓ Fallback drop-shadow
Android Chrome✓ Full (border-shape)

filter: drop-shadow() on .bsc-card already follows the clip-path contour natively. It is only cleared in the @supports block where box-shadow takes over — shapes remain visually clean on any browser without border-shape.

The code

HTML structure to paste into your page (CSS + JS available with a premium account):

index.html — structure
<div class="demo-preview">
  <div class="bsc-scene">

    <!-- Pointed tag — click cycles shapes (bscTag required) -->
    <button class="bsc-card bsc-card--tag" id="bscTag" type="button"
            aria-label="Tag card — click to cycle shapes">
      <span class="bsc-price">-40%</span>
      <span class="bsc-label">Summer sale</span>
    </button>

    <!-- Notched ticket -->
    <div class="bsc-card bsc-card--ticket">
      <div class="bsc-ticket-main">
        CONCERT
        <span>Row F · Seat 12</span>
      </div>
      <div class="bsc-ticket-stub">A-12</div>
    </div>

    <!-- Chat bubble with bottom tail -->
    <div class="bsc-card bsc-card--bubble">
      <p>Your text here.</p>
    </div>

  </div>
</div>
🔒 Unlock the full code — from €2.99 the first month

Full HTML + CSS + JS, copy-paste ready — with hundreds of premium effects.

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
clip-path / border-shape (polygon) shape-specific polygon per variant Define your geometry in clip-path (fallback) and paste the same value into border-shape (@supports). Both must stay in sync for consistent rendering.
background: linear-gradient(…) purple/pink — navy/blue — teal Each variant has its own gradient. Replace the color stops for your brand palette without touching the geometry.
filter: drop-shadow(…) (base) 0 10px 22px rgba(0,0,0,.55) Fallback shadow on .bsc-card (browsers without border-shape). Freely adjust offset, blur, and color.
box-shadow (@supports) 0 10px 26px rgba(0,0,0,.55) + purple hover glow Native shadow in border-shape browsers. Independent of filter; can take a tinted color for a brand glow on hover.
border (@supports) 1.5px solid rgba(255,255,255,.22–.35) Visible border only with border-shape (otherwise clip-path cuts it off). Opacity varies by variant: 0.35 tag, 0.22 ticket, 0.30 bubble.
shapes[] (JS, array ~line 7) 3 polygons: left arrow, right arrow, rectangle Shapes cycled on click on #bscTag. Add or remove polygons to extend the demo or lock to a single fixed shape.
transition (hover) .35s cubic-bezier(.2,.9,.3,1.4) Duration and easing of the translateY(-6px) and shadow change. Set to 0 in contexts where animation is unwanted.

FAQ

With clip-path, filter: drop-shadow already follows the cut — that's the fallback. But border and outline stay rectangular (clip-path simply cuts them off), and multi-layer or inset box-shadow is unavailable. border-shape redefines the box model: border, outline, and box-shadow (with multi-layer, inset, and color support) all follow the polygon geometry.
Define your geometry in clip-path: polygon(…) on the card variant, then paste the exact same value into border-shape inside the @supports block. The demo JS also syncs this polygon in the shapes[] array. To draw coordinates visually, use Firefox DevTools (built-in clip-path editor) or bennettfeely.com/clippy/.
Yes. The base CSS applies filter: drop-shadow() to .bsc-card and clip-path to each variant — a combination supported in all modern browsers. The @supports block progressively enhances the experience (native border + box-shadow) without ever breaking the fallback. The effect remains visually clean in Firefox and Safari.