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
  • ХоббиХобби

Комментарии • 27

  • @templa946
    @templa946 5 месяцев назад +2

    mmm...this is good on a single page site that doesn't get refreshed

    • @webbae
      @webbae  5 месяцев назад

      yea - I wish I had mentioned that! see pinned!

  • @jonasarleth
    @jonasarleth 6 месяцев назад +4

    I think my go to solution from now on

    • @webbae
      @webbae  6 месяцев назад +1

      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.

  • @mateusvidal3187
    @mateusvidal3187 6 месяцев назад +1

    The best tutorials are here! haha Clear and straight to the point! Thanks dude!

    • @webbae
      @webbae  6 месяцев назад +1

      Thank you Mateus!

  • @tolulopeabolarin2183
    @tolulopeabolarin2183 6 месяцев назад +1

    Thank you so much

  • @xamznerol
    @xamznerol 6 месяцев назад +1

    Thanks so much this comes exactly in the right time! 🎉❤

    • @webbae
      @webbae  6 месяцев назад

      Glad it helps! Be sure to check the pinned comment for a few thoughts on how to use this across page navigation/reload.

  • @kudz
    @kudz 6 месяцев назад +1

    Another banger🔥🔥

  • @dalejanzen3253
    @dalejanzen3253 6 месяцев назад +1

    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! 🤔🙃

    • @webbae
      @webbae  6 месяцев назад

      Thanks Dale - you're awesome!

  • @jclewis33
    @jclewis33 6 месяцев назад +1

    This is great. Easy way to switch to dark mode. Thanks for sharing.

  • @heatherliu6856
    @heatherliu6856 6 месяцев назад +2

    sickkkkkk thumb bruv

    • @webbae
      @webbae  6 месяцев назад

      say less.

  • @supercharge.studio8053
    @supercharge.studio8053 6 месяцев назад +1

    awesome, as per usual. Did your heating break down? :)

    • @webbae
      @webbae  6 месяцев назад

      hahahahah the GF and I have been experimenting with lowering our heating bill. Glad you noticed 🤣

  • @shahriarkhaneasan3268
    @shahriarkhaneasan3268 6 месяцев назад +1

    This is amazing🙂

    • @webbae
      @webbae  6 месяцев назад

      💯

  • @digitalshane_
    @digitalshane_ 6 месяцев назад +2

    "If you liked this video.." What if I LOVED it?!

    • @webbae
      @webbae  6 месяцев назад

      YOU STUCK AROUND TILL THE END 👑

  • @brainybitesOfficial035
    @brainybitesOfficial035 6 месяцев назад +1

    It's Amazing soldier

    • @webbae
      @webbae  6 месяцев назад +1

      🫡

  • @elektrotwerk
    @elektrotwerk 6 месяцев назад +1

    👌

    • @webbae
      @webbae  6 месяцев назад

      🫡

  • @joseaguilar5372
    @joseaguilar5372 3 месяца назад +1

    tired it didnt work can you give the code please

    • @webbae
      @webbae  3 месяца назад

      You can grab from the cloneable. Are you having issues with it?