Border Utilities: Width, Color, and Radius
You'll learn how to style element borders completely using Tailwind's utility classes for width, color, and rounded corners.
Borders frame your elements and define visual boundaries. Tailwind provides utility classes that let you control three key border properties without writing custom CSS: the thickness of the border, its color, and how rounded the corners should be.
Border Width
Use border utilities to set thickness:
border— adds a default 1px border on all sidesborder-0— removes borders entirelyborder-2,border-4,border-8— specific thickness valuesborder-t-4,border-r-2,border-b,border-l-8— control individual sides (top, right, bottom, left)
Border Color
Combine border width with border-{color} utilities from your theme:
border-gray-300— light gray borderborder-blue-500— medium blue borderborder-red-700— dark red border
The color works with your configured theme palette (the same colors from background and text utilities).
Border Radius
Round corners with rounded-* utilities:
rounded— subtle corner roundingrounded-lg— larger rounded cornersrounded-full— perfect circles or pillsrounded-t-lg,rounded-br-md— round specific corners (top, bottom-right, etc.)
Example combination: border-2 border-blue-500 rounded-lg creates a 2px thick blue border with nicely rounded corners.
Key Takeaway: Tailwind's border utilities (border-* for width, border-color-* for color, rounded-* for radius) give you complete control over border styling using composable utility classes instead of writing custom CSS rules.