Border colors
Border utilities add or remove borders and set their colour, width and roundness.
In this page:
Syntax
<div class="border border-primary">all sides</div>
<div class="border-top border-danger">top only</div>
Border colors
.border adds a border on all sides, .border-top and friends target sides, and .border-0 removes them. Colour with .border-primary, width with .border-1 to .border-5, and radius with .rounded, .rounded-circle and .rounded-pill.
Subtle border colours end with -subtle.
Note:
rounded-circle needs equal width and height to make a true circle.
Example: Border colors
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container">
<div class="border border-primary border-3 p-3 mb-2">border-primary border-3</div>
<div class="border-top border-danger p-3 mb-2">only a top border</div>
<div class="border rounded-pill p-2 mb-2 text-center">rounded-pill</div>
<div class="border border-success-subtle rounded-circle d-inline-block" style="width:4rem;height:4rem"></div>
</div>
</body>
</html>
Live Example
Related Topics
Common Mistakes
- Adding border colour without a border
- Forgetting border width classes
- Using custom CSS for radius
Chapter Summary
- border adds borders
- border-{color} sets the colour
- border-1 to 5 set width
- rounded-* sets radius
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: