Course contentsShow
← Web Development
Lesson 623 of 2,98211. Utility-First CSS with TailwindFree lesson

Border Utilities: Width, Color, and Radius

Control borders with border-*, border-color-*, and rounded-* utilities for complete border styling.

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 sides
  • border-0 — removes borders entirely
  • border-2, border-4, border-8 — specific thickness values
  • border-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 border
  • border-blue-500 — medium blue border
  • border-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 rounding
  • rounded-lg — larger rounded corners
  • rounded-full — perfect circles or pills
  • rounded-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.