How does dark mode work in Bootstrap 5.3?
<html lang="en" data-bs-theme="dark">
The attribute can be on the html element for the full page, or on one component (for example a navbar or a card). In your own CSS use variables like var(--bs-body-bg), and prefer .bg-body-tertiary to .bg-light. A theme switcher only changes the attribute with JavaScript. See Color Modes.
Learn more about the similar topics:
| Tutorials |
|---|
| Bootstrap Color Modes (Dark Mode) |
| Bootstrap Customization |
| Exercises & Assignments |
|---|
| Create a button which switches the page to dark mode |