Utilities✨ Premium

Corner Accent Borders

A box with an almost invisible edge, marked by four coloured corner brackets that stretch from 20 to 40 px with a glow on hover, keyboard focus or tap.

CSSHoverCorners

Updated

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

3 usage examples

Viewfinder around the drop zone of a background-removal tool — Corner Accent Borders example 1

① Viewfinder around the drop zone of a background-removal tool

WhenOn the Clipravelle home page, the “Drop your photo here” zone is framed by four large brackets like a camera viewfinder; they open up when the mouse arrives or the “Choose a file” button gets focus.
WhyThe brackets say “put your picture in this frame” without drawing dashes around the whole zone, and their stretch confirms you are aiming at the right target.
Settings--cnb-w: 244px; --cnb-h: 214px; --cnb-size: 30px; --cnb-size-hover: 64px; --cnb-thickness: 4px; --cnb-fill: #12131a; default colours; a <button> replaces the link.
Developments on sale on a property developer's site — Corner Accent Borders example 2

② Developments on sale on a property developer's site

WhenMorvanesse Homes shows its three developments on sale (homes handed over from 2026 to 2028) as white cards on a linen background; the brass brackets of the hovered card unfold along its edges.
WhyThin corners recall the framing marks of a plan, a familiar language in new-build property, and point to the targeted development without covering the illustrations.
SettingsOne root for the three cards, in a grid; --cnb-w: 100%; --cnb-h: 214px; --cnb-fill: #fff; all four colours set to #a07a3f; --cnb-size: 18px; --cnb-size-hover: 46px. On this light background, the shadow square in each corner shows more.
Picking a layout in a newsletter editor — Corner Accent Borders example 3

③ Picking a layout in a newsletter editor

WhenIn the Plumorelle editor, six 70 × 88 px layout thumbnails; the one pointed at by mouse or keyboard opens its small brackets, and a click applies the layout to the preview on the left.
WhyAt small size, the brackets act as a precise hover marker in a tight grid; the chosen thumbnail keeps its own marker (coloured text, aria-pressed), independent from the effect.
Settings--cnb-w: 70px; --cnb-h: 88px; --cnb-size: 10px; --cnb-size-hover: 24px; --cnb-thickness: 2px; --cnb-fill: #181b24; each thumbnail holds a <button class="cnb-link">; the preview is wired in the scene.

How it works

The .cnb-box (200 × 120 px, 12 px radius) only has a white outline at 8 % opacity, barely visible. Its four corners are held by 20 × 20 px <span class="cnb-corner"> elements placed 2 px outside the edge; each one draws only two 3 px sides (top and left for the top-left corner, and so on) with a small 4 px radius, forming a bracket. The colours go from indigo to pink around the box: #6366f1 top left, #8b5cf6 top right, #d946ef bottom right, #ec4899 bottom left.

On hover, or when something in the box has focus (:focus-within), every bracket grows to 40 × 40 px in 0.4 s on a curve that speeds up then brakes, and gets a soft shadow in its own colour at 40 %, offset 3 px outwards. That shadow belongs to the bracket's whole square: it also draws a faint darker square inside each corner, subtle on dark backgrounds, more visible on light ones.

The label is a real link, .cnb-link, whose ::after covers the whole box: the entire box is clickable, and focusing or tapping that link stretches the brackets. A button or a field placed in the box does the same, like the “Choose a file” button in the drop-zone example.

Accessibility

  • Keyboard: Tab reaches the link (or button) in the box; the brackets stretch and a white ring (--cnb-ring) appears around the box when focus comes from the keyboard. Safari only stops on links with Tab if its keyboard setting allows it (Option+Tab otherwise).
  • Touch: tapping the link stretches the brackets in Chromium, Firefox and WebKit (measured with a simulated touch screen); a box with nothing interactive inside would not react to a finger in WebKit.
  • Reduced motion: with prefers-reduced-motion: reduce, the brackets jump from 20 to 40 px at once, glow included, without sliding.
  • Box outline: the 8 % outline is not enough for everyone to see the clickable area; the brackets mark it at the corners. On a background where they show poorly, make them thicker (--cnb-thickness).

Browser compatibility

Pure CSS, no JavaScript. Measured in Chromium 151, Firefox 153 and Playwright's WebKit 26.5: 0 errors, two independent copies, hover, Tab, touch, 390 px and reduced motion. Minimum versions from @mdn/browser-compat-data: the glow is computed with color-mix() (Chrome 111, Firefox 113, Safari 16.2); the rest needs inset for the stretched link (Chrome 87, Firefox 66, Safari 14.1).

Chrome 111+✓ Full (measured in version 151); from 87 to 110, brackets without glow
Firefox 113+✓ Full (measured in version 153); from 66 to 112, no glow
Safari 16.2+✓ Full (measured in WebKit); from 14.1 to 16.1, no glow
Edge 111+✓ Full (Chromium engine)
Safari iOS 16.2+✓ Full, brackets when the link is tapped (measured in touch WebKit)
Chrome Android 111+✓ Full (Chromium engine)

Without color-mix(), the shadow declaration is dropped: the brackets stretch without a glow. For a glow everywhere, replace color-mix(in srgb, var(--cnb-c1) 40%, transparent) with a fixed colour such as rgba(99, 102, 241, .4).

The code

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

index.html — structure
<div class="fx-0772-root">
  <div class="cnb-box">
    <span class="cnb-corner cnb-tl"></span>
    <span class="cnb-corner cnb-tr"></span>
    <span class="cnb-corner cnb-br"></span>
    <span class="cnb-corner cnb-bl"></span>
    <a class="cnb-link" href="#corner-accent">Corner Accent</a>
  </div>
</div>

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

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
--cnb-size and --cnb-size-hover 20px and 40px Arm length of each bracket at rest, then on hover, focus and tap.
--cnb-thickness 3px Stroke width of the brackets.
--cnb-c1 to --cnb-c4 #6366f1, #8b5cf6, #d946ef, #ec4899 Colour of each corner, in the order top left, top right, bottom right, bottom left; the glow uses the same colour.
--cnb-speed .4s Duration of the stretch and of the glow fading in.
--cnb-w and --cnb-h 200px and 120px Box size; the width never exceeds the container.
--cnb-fill #0a0a0f Box background.
--cnb-ring #fff Colour of the keyboard focus ring.

FAQ

The CSS sets color: #fff on .cnb-box. On a light card, give the content (heading, text) its own colours, set --cnb-fill to the card background and pick dark or saturated brackets, like the brass in the property developer example.
The glow is a box-shadow on the bracket element, which is a square with only two sides drawn. So the shadow follows the whole square. For a glow limited to the stroke, replace box-shadow in the four rules with filter: drop-shadow(0 0 6px var(--cnb-c1)) (--cnb-c2, --cnb-c3, --cnb-c4 depending on the corner): the shadow then follows the stroke shape.
The effect has no “selected” state: it reacts to hover and focus. To mark a lasting selection, add a rule on your element that gives .cnb-corner the size var(--cnb-size-hover), and back it up with text or aria-pressed so it does not rely on shape alone.