CSS Hack: Toggle Dark Mode with :has()
HTML-код
- Опубликовано: 6 авг 2024
- The CSS :has() selector can be used to toggle dark mode, light mode, and themes with zero Javascript, just HTML and CSS. :has() finally arrived in all major browsers, having dropped in Firefox December 2023.
👯♀️ Clone it:
try.webflow.com/cloneable-is-...
// FREE resources
✂️ Code Snippet Library: code-snippets-sign-up.webflow...
🤝 CSS Nobody Told You About: www.webbae.net/css-nobody-tol...
🚗 Roadmap to learn Webflow: www.webbae.net/roadmap-to-lea...
// Premium content
🤝 Patreon: / webbae
🕸️ Advanced Webflow Course (201): www.webbae.net/product/webflo...
// Discounts
🎢 Get 10% GSAP: WEBBAE10
♣️ Creative Coding Club (My favorite GSAP lessons): www.creativecodingclub.com/bu...
// Connect
🙋♀️ Join the Discord: / discord
🐥 Follow Me! / webisbae - Хобби
mmm...this is good on a single page site that doesn't get refreshed
yea - I wish I had mentioned that! see pinned!
I think my go to solution from now on
Thanks Jonas - check pinned comment for thought on storing preference between refresh and page load! Maybe I'll throw together a tutorial on that when I get a chance.
The best tutorials are here! haha Clear and straight to the point! Thanks dude!
Thank you Mateus!
Thank you so much
Thanks so much this comes exactly in the right time! 🎉❤
Glad it helps! Be sure to check the pinned comment for a few thoughts on how to use this across page navigation/reload.
Another banger🔥🔥
I am not saying I am a code warrior by any means... but your championing of code as an enabling superpower (the how and also importantly the why) is beginning to dampen my resistance! 🤔🙃
Thanks Dale - you're awesome!
This is great. Easy way to switch to dark mode. Thanks for sharing.
sickkkkkk thumb bruv
say less.
awesome, as per usual. Did your heating break down? :)
hahahahah the GF and I have been experimenting with lowering our heating bill. Glad you noticed 🤣
This is amazing🙂
💯
"If you liked this video.." What if I LOVED it?!
YOU STUCK AROUND TILL THE END 👑
It's Amazing soldier
🫡
👌
🫡
tired it didnt work can you give the code please
You can grab from the cloneable. Are you having issues with it?