CSS offers three distinct techniques for creating double borders, each with different trade-offs for spacing control, compatibility, and interaction with layout.
Loading Border Builder…
Preview border-style: double with adjustable width
Outline plus border combination for two distinct rings
Box-shadow technique for fully controllable extra border layers
Generates CSS for all three techniques side by side
Drop the Border Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/border-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Border Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
Border-style: double is the most direct approach but the least flexible. The total border-width is divided into three equal parts: the first third is the inner line, the middle third is the gap, and the final third is the outer line. At 3px total width, each section is exactly 1px. At 6px, each section is 2px. You cannot control the gap size or make the two lines different colors with this property alone. Border-style: double is best for decorative frames, table borders in formal documents, and print stylesheets where a traditional double-line appearance is appropriate and the automatic proportioning is acceptable.
Combining outline and border gives you two independently controllable rings. The border forms the inner ring and outline forms the outer ring. Because outline is drawn outside the border box, the gap between the two rings is determined by outline-offset. Setting outline-offset: 0 places the outline directly against the border; positive values add a gap. Each ring can have a different color, width, and style. This technique is clean and uses no additional DOM elements, but outline does not affect layout and may overlap surrounding elements if the gap is large. Also, outline does not always follow border-radius in older browsers.
Box-shadow can simulate multiple border layers by stacking shadows with zero blur and no offset. Setting box-shadow: 0 0 0 2px #6366f1, 0 0 0 4px #fff, 0 0 0 6px #6366f1 creates three concentric rings. The first shadow creates the inner ring at 2px, the second creates a 2px white gap, and the third adds an outer ring at 6px from the element edge. Box-shadow always follows border-radius and does not affect layout. You can add as many layers as needed. The main limitation is that box-shadow is applied to the outer edge of the element, so the first layer adds spacing at the border outside, which may interact with adjacent elements' padding areas.
The choice between double border-style, outline-plus-border, and stacked box-shadow becomes clearer when you consider how each renders the inset and outset 3D effects that browsers tried to standardise long ago. Inset and outset borders calculate their dark and light sides from the border-color value, but the exact gradient stops are left to the implementation. Chrome, Firefox, and Safari each produce slightly different lightness offsets, so the bevel effect that looked acceptable in one browser can look muddy or stark in another. The double border-style sidesteps this because it uses a flat colour for both lines and lets the browser do nothing more than divide the width into three equal sections. For consistent multi-ring effects across browsers, stacked box-shadow with explicit colour values produces identical results everywhere because every parameter (offset, blur, spread, colour) is fully specified rather than computed. When pixel-perfect consistency matters, prefer box-shadow stacking over inset, outset, ridge, or groove.
Start with border-style: double at 6px to see the two-line effect. Switch to the outline combination mode to add an independent outer ring. Use the box-shadow mode for full control over spacing and color between border layers.
Step-by-step guide to css double border generator:
Choose a double border technique
Select from border-style: double, outline-plus-border, or box-shadow layers. Each appears in the preview simultaneously so you can compare the visual results before choosing.
Set border-width for double style
For border-style: double, set width to 6px or higher to see two clearly visible lines with a gap. At 3px, the lines are 1px each, which is minimal but visible.
Adjust spacing for outline or box-shadow techniques
For outline, use outline-offset to control the gap. For box-shadow, adjust the spread values of each layer to control inner and outer ring distances.
Copy the CSS
Copy the generated CSS for your chosen technique. The tool provides all required declarations including outline-offset for the outline approach and the full box-shadow stack for the layered approach.
Common situations where this approach makes a real difference:
Selected item ring indicator in a photo gallery
A selected image in a gallery needs a visible selection ring without affecting grid layout. Using box-shadow: 0 0 0 3px white, 0 0 0 5px #6366f1 adds a white inner gap and a blue outer ring. Both follow the image's border-radius and sit outside the layout box. The white gap creates clear separation between the image edge and the selection color, which is a common pattern in file pickers and image selectors.
Decorative double border on a section heading
A section heading or pull quote uses border: 4px double #6366f1 for a formal two-line decorative border. At 4px, the double style shows two 1.3px lines with a 1.3px gap. Combined with padding and a slightly colored background, this creates a formal document aesthetic appropriate for academic or legal document interfaces.
Focus ring layered on top of an existing button border
A button with border: 1px solid #d1d5db needs a focus ring that does not modify its existing border. Adding outline: 2px solid #6366f1 with outline-offset: 2px on :focus-visible places the focus ring outside the existing border with a 2px gap. The button's border and the focus ring are completely independent, so neither state change affects the other.
Multi-ring badge on a notification icon
A notification badge on an icon button uses multiple box-shadow rings to create a pulsing effect. The static state has box-shadow: 0 0 0 2px white, 0 0 0 4px #ef4444, giving a white gap and a red outer ring. A CSS animation scales the outer shadow ring outward for the pulse effect. This builds on top of the icon's normal box model without additional elements.
Get better results with these expert suggestions:
Box-shadow layers do not affect layout
Unlike border, box-shadow layers do not expand the element's layout dimensions. Multiple stacked box-shadow rings extend into the margin area visually but do not push adjacent elements. This is the main advantage over adding actual borders: you can add decorative rings without adjusting padding, margin, or element dimensions elsewhere in your layout.
Combine border and inset box-shadow for inner and outer rings
Setting box-shadow: inset 0 0 0 2px #6366f1, 0 0 0 2px #6366f1 creates one ring inside the element (inset) and one ring outside. Adding border: 2px solid white between them creates a three-ring effect: inner ring, white border gap, outer ring. This is a controlled way to build multi-ring indicators for selected states.
Use outline for focus rings on top of a normal border
Elements with their own border can use outline as a second ring for the :focus-visible state without removing or modifying the existing border. The outline appears outside the border automatically. Set outline-offset to control the gap. This avoids any changes to the element's border properties on focus, which could cause layout shifts.
Border-style: double works well in print stylesheets
Print stylesheets often use border-style: double for table borders, blockquote containers, and formal document elements. The browser's automatic proportioning of the two lines and gap is sufficient for print contexts where pixel-perfect control is less critical than semantic simplicity and minimal CSS overhead.
Use box-shadow layers for unlimited border rings
Box-shadow accepts a comma-separated list of shadows. Stack multiple 0 0 0 Npx values at increasing spread values to create concentric rings: 0 0 0 2px #color1, 0 0 0 4px white, 0 0 0 6px #color2. Each layer adds another ring at a specified distance from the element edge.
Border-style: double needs at least 3px to show
At 1px or 2px, the double border style renders as solid because there is not enough space to show both lines and the gap. Set border-width to 3px minimum to see the double effect. At 6px you get a clearly visible two-line appearance with a 2px gap.
Outline-offset: 0 places outline flush against border
When combining outline and border for a double border effect, setting outline-offset: 0 removes the gap between border and outline. Both rings sit adjacent, creating a two-line effect similar to border-style: double but with independent color and width control.
More use-case guides for the same tool:
Other tools you might find useful:
Open the full Border Builder — free, no account needed, works on any device.
Open Border Builder →Free · No account needed · Works on any device