Skip to content

Bootstrap Wells

The .well class from older Bootstrap versions, which created an inset effect for content, has been deprecated in Bootstrap 4 and removed in Bootstrap 5. However, you can achieve a similar visual style using Bootstrap’s utility classes for background, padding, borders, and shadows.

Basic Inset-like Styling Example:

Here’s how you can create a similar effect using Bootstrap 5 utility classes:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<title>Simulating Wells</title>
</head>
<body>
<div class="container mt-3">
<div class="p-3 mb-2 bg-light border rounded">
This content has a light background, padding, a border, and rounded corners, similar to a basic well.
</div>
</div>
</body>
</html>

In this example: .p-3 adds padding. .mb-2 adds margin at the bottom. .bg-light provides a light gray background. .border adds a default border. .rounded adds rounded corners.

You can customize the appearance further by using different background color utilities (e.g., .bg-body-secondary), padding utilities (.p-1 to .p-5), and border utilities.

Example with different padding and background:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-3">
<div class="p-4 mb-3 bg-body-secondary border rounded-3">
Larger padding, different background, and more pronounced rounding.
</div>
<div class="p-2 mb-3 bg-dark text-white border border-secondary rounded-0">
Dark background, smaller padding, and no rounded corners.
</div>
</div>
</body>
</html>
Bootstrap 5 encourages using utility classes for flexible and custom styling over predefined components like wells. Cards are another modern alternative for grouping content.