Basic Dark Mode

Enable dark mode using the data-bs-theme attribute.

Preview

Code

<!DOCTYPE html>
<html data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container py-5">

<h3>Dark Mode Enabled</h3>
<p>This page uses Bootstrap's dark theme.</p>

<button class="btn btn-primary">Primary Button</button>

</div>

</body>
</html>

More BS5 Dark Mode Examples (7)