CSS Border Generator
Set border width, style and colour for all four sides or each side on its own, see it live, and copy clean CSS.
Set border width, style and colour for all four sides or each side on its own, see it live, and copy clean CSS.
The output uses the shortest correct form: one border shorthand when all sides match, separate border-top, border-right, border-bottom and border-left rules when they differ.
| Style | Looks like | Typical use |
|---|---|---|
solid | One continuous line | Cards, inputs, dividers |
dashed | Short dashes | Drop zones, "add new" placeholders |
dotted | Round dots | Subtle separators, focus hints |
double | Two parallel lines (needs at least 3px) | Classic frames, receipts |
groove / ridge | Carved or raised 3D edge, shaded from the colour | Retro interfaces |
inset / outset | Box looks pressed in or out | Old-style buttons |
A border takes up space and changes the element's size unless you use box-sizing: border-box, which is why that option is on by default. An outline is drawn outside the box without affecting layout and is used for focus rings, with outline-offset adding a gap. A box-shadow with zero blur, such as box-shadow: 0 0 0 3px #4f46e5, also draws a line without affecting layout and follows border-radius. For soft shadows use the box shadow generator, and for complex corners the border radius generator.
Tick "Style each side separately" and set the other sides' style to none, or write border-bottom: 2px solid #4f46e5; directly.
A double border needs room for two lines and a gap, so it only shows at 3px or more.
Borders cannot take gradients directly. Use border: 4px solid transparent; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, #4f46e5, #ec4899) border-box;.