Generate CSS for linear gradient borders
Generate and copy CSS for gradient borders. Tune colors, angle, and width with live preview—local-first, no sign-in.
Gradient border
Live preview of the copied CSS
linear-gradient(135deg, #2563eb 0%, #db2777 100%)
Supports border-radius via padding-box / border-box layers.
Presets
Help Us Improve
—
(—)
Ask AI
What is a CSS border linear gradient?
Gradient border features
Two CSS methods
Use the background-clip trick for rounded boxes, or border-image for a simpler rule that does not follow border-radius.
Editable stops and angle
Set two or three HEX stops, positions, and the linear angle of the border gradient.
Width, radius, and fill
Control border thickness, corner radius (background method), and the inner fill color.
Copy-ready CSS
Copy a complete class rule that matches the live preview.
How to generate a gradient border
Choose a method
Pick background clip when you need rounded corners. Pick border-image when a shorter rule is enough and radius does not matter.
Tune the edge
Edit stop colors, angle, and border width. Set radius and inner fill for the background method.
Copy the rule
Paste the CSS block onto a card, button, or frame and attach the class name.
Tips for gradient outlines
Rounded corners need the background trick
border-image ignores border-radius. The copied background-clip rule layers a solid fill on padding-box and the gradient on border-box.
Match the inner fill to the page
The background method paints the fill color inside the border. Set it to your card or page background so the center does not look like a second gradient.
Keep backgrounds on the background tool
A full-bleed linear-gradient behind content belongs on CSS Gradient Creator, not in a border rule.
Headline fill is a different clip
For gradient letters, use Text Gradient CSS Generator with background-clip: text.
Great for
Feature cards
Pricing tiles, testimonial frames, and highlight modules with a thin gradient outline.
Buttons and chips
Call-to-action chrome that needs a gradient stroke without filling the label.
Frontend handoff
Copy a complete rule instead of reconstructing dual background-clip layers by hand.
Why generate the CSS here
Local-first
Stops, width, and CSS stay in the browser. Nothing is uploaded.
Honest methods
The UI names the radius limitation of border-image instead of hiding it.
Free to use
Unlimited copies with no sign-in.
Live preview
See thickness, radius, and fill update as you edit.
Technical notes
- Background method
- Uses a transparent border, then two background-images: a solid fill clipped to padding-box and a linear-gradient clipped to border-box, with background-origin: border-box.
- border-image method
- Sets border-style and width, then border-image: linear-gradient(...) 1. Corner radius is ignored by this method.
- Inputs
- HEX stops, stop positions, linear angle, border width, radius, inner fill, and method.
- Outputs
- A linear-gradient() value and a complete class rule for the selected method.
- Processing
- All generation runs client-side. No network calls for the generator.
Sources & References
“The border-image CSS shorthand property draws an image around a given element. It replaces the element's regular border.”
MDN — border-image: The border-image method on this page copies border-image: linear-gradient(...) 1 with a solid border width, matching the documented gradient example. developer.mozilla.org/en-US/docs/Web/CSS/border-image
“border-radius has no effect on the border image. This is because border-image-outset is able to place the image outside the border box, so it doesn't make sense for the border image to be clipped by the border area. To create rounded borders when using a border image, you should create the image itself with rounded corners, or, in the case of a gradient, draw it as the background instead.”
MDN — rounded gradient borders: The default method layers a solid fill clipped to padding-box and a linear-gradient clipped to border-box so rounded corners keep a gradient stroke. developer.mozilla.org/en-US/docs/Web/CSS/border-image
“The linear-gradient() CSS function creates an image consisting of a progressive transition between two or more colors along a straight line.”
MDN — linear-gradient(): Stop colors, positions, and angle compile to a standard linear-gradient() used as the border image source or as the outer background layer. developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient