Skip to content
Justice Tech School

Dark Mode and Color Modes

Bootstrap 5.3 supports light and dark with the data-bs-theme attribute. Set it on html or on any element to change only that part.

Example
<html lang="en" data-bs-theme="dark">
...
<div data-bs-theme="light" class="p-3 bg-body">Light card inside dark page</div>

Exercise

Set the dark theme.

data-bs-theme=""

Quiz Test

Which attribute switches color mode?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.