Borders and Border Radius in Tailwind CSS
Tailwind provides utility classes to control border width, color, and corner radius, allowing for quick and flexible styling of element outlines and rounded corners.
1. Border Width
Use classes like border
, border-2
, border-4
, etc. to define thickness:
border
border-4
Top Border
2. Border Color
Apply border color using border-{color}
classes:
Red Border
Green Border
Blue Border
3. Border Radius
Control rounding with classes like rounded
, rounded-lg
, rounded-full
:
rounded
rounded-lg
rounded-full
4. Individual Corners
Tailwind also allows rounding specific corners:
Top Rounded
Bottom-Left Rounded
Top-Right Full
5. Best Practices
- Use
rounded
consistently to create visual softness - Combine border color with background contrast
- Use
rounded-full
for circles or avatars
Conclusion
Tailwind's border utilities give you complete control over element outlines and rounded edges without writing custom CSS. Great for cards, buttons, avatars, and layout boxes.