Borders & Rounded Corners
Borders outline and separate content, and rounded corners soften it. Tailwind also has rings and outlines — borders that don't take up layout space — and divide utilities for lines between children.
Border width, colour and style
| Class | Effect |
|---|---|
border |
1px border on all sides |
border-2 / border-4 / border-8 |
thicker borders |
border-t / border-x-2 / border-b-4 … |
only some sides |
border-gray-300 |
border colour |
border-dashed / border-dotted / border-double / border-none |
style |
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="grid grid-cols-3 gap-3 p-4 text-center text-sm">
<div class="border border-gray-400 p-3">border</div>
<div class="border-4 border-sky-500 p-3">border-4</div>
<div class="border-2 border-dashed border-rose-500 p-3">dashed</div>
<div class="border-b-4 border-amber-400 p-3">border-b-4</div>
<div class="border-l-8 border-emerald-500 bg-emerald-50 p-3">border-l-8</div>
<div class="border-4 border-double border-violet-500 p-3">double</div>
</body>
</html>Note: In v4 the default border colour is
currentColor(in v3 it wasgray-200). A lonelyborderclass therefore draws a line in the text colour — always add a colour.
Rounded corners
| Class | Radius | v3 name |
|---|---|---|
rounded-xs |
0.125rem | rounded-sm |
rounded-sm |
0.25rem | rounded |
rounded-md |
0.375rem | same |
rounded-lg |
0.5rem | same |
rounded-xl / rounded-2xl / rounded-3xl |
0.75 / 1 / 1.5rem | same |
rounded-full |
fully round (pills and circles) | same |
rounded-none |
square | same |
Round specific corners with a side or corner: rounded-t-lg, rounded-r-full, rounded-bl-3xl, rounded-s-lg (start side).
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex flex-wrap items-center gap-3 p-4 text-xs text-white">
<div class="flex size-20 items-center justify-center rounded-sm bg-fuchsia-500">sm</div>
<div class="flex size-20 items-center justify-center rounded-lg bg-fuchsia-500">lg</div>
<div class="flex size-20 items-center justify-center rounded-3xl bg-fuchsia-500">3xl</div>
<div class="flex size-20 items-center justify-center rounded-full bg-fuchsia-500">full</div>
<div class="flex size-20 items-center justify-center rounded-tl-3xl rounded-br-3xl bg-fuchsia-500">tl + br</div>
<span class="rounded-full bg-fuchsia-100 px-3 py-1 text-fuchsia-700">pill badge</span>
</body>
</html>Rings and outlines
A ring is a box-shadow drawn around the element, so it never shifts the layout. It's ideal for focus indicators and avatar outlines.
| Class | Effect |
|---|---|
ring / ring-2 / ring-4 |
ring width (1px, 2px, 4px) |
ring-sky-500 |
ring colour |
ring-offset-2 + ring-offset-white |
a gap between element and ring |
inset-ring-2 |
ring drawn inside the element |
outline-2 outline-offset-2 outline-sky-500 |
a real CSS outline |
outline-hidden |
hide the outline but keep it in forced-colours mode |
Note: v4 changed
ringfrom 3px blue to 1px incurrentColor— usering-3for the old size. Also, v3'soutline-noneis nowoutline-hidden;outline-nonenow really setsoutline-style: none.
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="flex items-center gap-6 p-6">
<div class="flex size-14 items-center justify-center rounded-full bg-amber-200 text-2xl ring-4 ring-white ring-offset-2 ring-offset-amber-500">🐼</div>
<button class="rounded-md bg-sky-600 px-4 py-2 text-white focus:ring-4 focus:ring-sky-300 focus:outline-hidden">Tab to me</button>
<input placeholder="Focus me" class="rounded-md border border-gray-300 px-3 py-2 focus:outline-2 focus:outline-offset-2 focus:outline-violet-500">
</body>
</html>Dividers between children
divide-y adds a top border to every child except the first — perfect for lists. Colour it with divide-gray-200.
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
</head>
<body class="p-4">
<ul class="w-64 divide-y divide-slate-200 rounded-xl border border-slate-200 bg-white">
<li class="px-4 py-2">Inbox</li>
<li class="px-4 py-2">Drafts</li>
<li class="px-4 py-2">Sent</li>
<li class="px-4 py-2">Archive</li>
</ul>
<div class="mt-4 flex w-64 divide-x-2 divide-dashed divide-slate-300 text-center">
<span class="flex-1">12 posts</span><span class="flex-1">340 likes</span>
</div>
</body>
</html>Tip: For a card with an image on top, combine
rounded-xl overflow-hiddenon the card so the image's corners are clipped too.
Test yourself
What is the v4 equivalent of v3's plain rounded class (0.25rem)?
rounded-xsrounded-smrounded-mdrounded-base
Why are rings popular for focus styles?
- They animate automatically
- They are drawn with box-shadow and don't change the layout
- They only work on buttons
- They hide the default outline
Which class draws a line between each item of a vertical list?
border-ydivide-yspace-y-pxseparator-y