Huefold

CSS gradient border

The color belongs on the edge.

Rounded corners.
A clean inside.

Rounded border CSS

Add class="gradient-border" to your element. Free to use; no sign-up. Padding is yours to adjust.

Three methods, three trade-offs

For the default example, a 6px border with a 24px outer radius leaves an approximately 18px inner radius. The browser handles the exact corner geometry. A solid inside is part of this method; it is not a transparent hole.

Layered backgrounds

The main output above uses a transparent border, a solid gradient clipped to the padding box, and the color gradient clipped to the border box. It follows border-radius without extra markup. Limit: the center is opaque and replaces the element’s existing background.

A wrapper with padding

Use two elements: <div class="frame"><div class="frame-inner">Content</div></div>. The outer padding makes the border thickness. It handles rounded corners, but adds markup and still requires an opaque inner fill.

border-image for square edges

One element and no background layering. Limit: border-image does not follow border-radius in the way a normal border does. Use it for square corners; the radius control is deliberately absent from this output.

Check the actual component

Existing backgrounds, images, focus outlines and overflow settings can affect the final component. Keep focus indicators visible outside the border. CSS includes a sampled sRGB fallback before the modern interpolation declaration. Consult MDN border-image and background-clip for current support.