Posted in Bootstrap
2756
12:21 am, February 23, 2022
 

Added Bootstrap Nightshade Again

I did have a toggle dark mode switch on the top right of this site. 

But i noticed when i loaded in the page it would flash white and then load in the dark mode.

This is really annoying when loading multiple pages on the same site. 

So back to this nightshade again, which just applies light or dark mode depending on your operating system preference, if you like things in dark mode, it just applies it. Easy. 

Maybe the old one was called Nightshade and this one is just called bootstrap dark, anyway this is the css. 

Bootstrap Dark

HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.0.1/dist/css/bootstrap-dark.min.css" />

vs

Bootstrap Nightshade and Toggle

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap-utilities.min.css" integrity="sha512-kRvJclW5GazdbAJPE9vvs560XNBwTBGLg4RVHZALXHFnAWQeRbQ/jGcGDHcQXiiqRld4wEFs6Kpoa6Tm/wCrtg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-nightshade.min.css" rel="stylesheet">

Toggle Code

HTML

<div class="form-check form-switch dark-mode-switch">
  <input class="form-check-input" type="checkbox" id="DarkMode">
  <label class="form-check-label" for="DarkMode">Dark Mode</label>
</div>

Sources

Bootstrap Nightshade

View Statistics
This Week
46
This Month
191
This Year
760

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in Bootstrap
Search Articles
Search Articles by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
I'm a big believer in energy and the secret and that sort of thing.
Unknown
Random CSS Property

scroll-padding-block-end

The scroll-padding-block-end property defines offsets for the end edge in the block dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
scroll-padding-block-end css reference