可以使用背景颜色类来设置元素的background-color,类名以bg开头,例如:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div class="container">
<p class="bg-primary">背景颜色是bg-primary</p>
<p class="bg-white">背景颜色是bg-white</p>
<p class="bg-success">背景颜色是bg-success</p>
<p class="bg-info">背景颜色是bg-info</p>
<p class="bg-warning">背景颜色是bg-warning</p>
<p class="bg-danger">背景颜色是bg-danger</p>
<p class="bg-secondary">背景颜色是bg-secondary</p>
<p class="bg-dark text-white">背景颜色是bg-dark</p>
<p class="bg-light text-dark">背景颜色是bg-light</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous">
</script>
</body>
</html>