CSS Dark Mode Toggle Button from scratch in 6 Minutes

Поделиться
HTML-код
  • Опубликовано: 3 фев 2025
  • НаукаНаука

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

  • @thedisastro4492
    @thedisastro4492 2 года назад +8

    Man you doing perfect things. Your channel is underrated. Im sorry for others who do not know your channel. Keep going.

  • @WebDevXpert
    @WebDevXpert 9 месяцев назад

    Toggle Button In HTML CSS JavaScript |Animated Toggle Button using HTML CSS, JS|Dark and Light Mode : ruclips.net/video/VzjaQM8_nyE/видео.html

  • @N.A.Schilder
    @N.A.Schilder 7 месяцев назад +7

    Amazing video! I have one tip for accessibility, if you don't mind me giving it to you. If you put the visibility to hidden, the checkbox can't always be found by people who use screenreaders or keyboards only. So if you put opacity to 0 and give it a position of absolute, it can always be found by everyone. :)

    • @Riya-fu1qz
      @Riya-fu1qz 2 месяца назад

      thank you! i was looking for it from an accessibility standpoint too!

  • @SlimBloodworth
    @SlimBloodworth 2 года назад +3

    I ALWAYS enjoy your videos and learn something new each time! Thanks!

  • @Pupu._
    @Pupu._ 2 года назад +1

    Didn’t know if switch is made from input element. Thanks!

  • @Lokesh3152
    @Lokesh3152 2 года назад

    Pls don't stop keep making videos

  • @kiaru5131
    @kiaru5131 Год назад

    This is perfect. Thanks for sharing!

  • @k4nh00
    @k4nh00 Год назад +1

    Thank you very much for your help, it was identical to yours. The only comment I can leave is that it is much easier with javascript than with css. Greetings!

  • @quielsystems
    @quielsystems 2 года назад +1

    I love it! Keep uploading videos like this!

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

    Thank you ❤

  • @EntertainmentTv312
    @EntertainmentTv312 2 года назад +1

    Very Awsome Video.Thanks for making this video

  • @FrauleinRose
    @FrauleinRose 2 года назад

    i'm here for the moon icon 🌙🙌

  • @appleman29
    @appleman29 Год назад +10

    did not work. I did it right but not showing on my site

  • @mritellthings8554
    @mritellthings8554 2 месяца назад

    this works! but may I ask? why does it only cover part of my website? but not all?

  • @amjadnikzad4890
    @amjadnikzad4890 2 года назад

    Well done

  • @Daniblueboy
    @Daniblueboy 2 года назад

    awesome, thanks

  • @mahdinajafi3707
    @mahdinajafi3707 Год назад

    my html css: Yours: I hate myself

  • @VXTivkot
    @VXTivkot Год назад

    insteAD OF USING ACTIVE YOU SHOULD USE THE hover

  • @אביתרוייס-צ1ק
    @אביתרוייס-צ1ק 10 месяцев назад

    Why do we have a + in: “input:checked +label”? It’s not supposed to be: “input:checked label”?

  • @funkeboodha
    @funkeboodha Год назад +2

    Unless your website is only one page, this solution will not save your preference from page to page. It will load whatever state is default in your CSS.

    • @zedwelly5034
      @zedwelly5034 Год назад

      Just the problem for me. Do you know the solution for it to be on a whole site remembered?

    • @eamontanner6778
      @eamontanner6778 Год назад

      You need to create a session for this. I'd recommend creating a database and storing user preferences in there. You can interface with the database using a server-side language like php.

  • @matehun5219
    @matehun5219 2 года назад +1

    Make a vid from audio visualizers :D

  • @aryanmn1569
    @aryanmn1569 2 года назад

    Now I got why it's called stapler

  • @sam-nc8zv
    @sam-nc8zv 2 года назад

    Superb content... Gald I found your channel.. #subscribed

  • @kashishyenare1556
    @kashishyenare1556 Год назад +2

    My inner icon isn't visible I've coded the whole code step by step

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 года назад +1

    Awesome video ++++++ 😃

  • @אביתרוייס-צ1ק
    @אביתרוייס-צ1ק 10 месяцев назад

    Awesome

  • @broli450
    @broli450 2 года назад

    You should use ids and classes

  • @highinspiration9988
    @highinspiration9988 2 года назад

    Amazing

  • @reynandelizo1480
    @reynandelizo1480 Год назад

    I have an issue on sun and moon svg icons outside in my label tag even the position of label is realtive I don`t know the issue.

    • @Asdpire
      @Asdpire Год назад +2

      Hi, I don't know if this message reaches you, but the svg:s have a defaulf height which differs from the desired, so just set height to the same as the toggle switch. Hope this helps!

    • @nexi__cz2061
      @nexi__cz2061 9 месяцев назад

      @@Asdpire you just saved me 2-3 hours figuring out how to fix that i love you

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

    522 error

  • @anniepunk
    @anniepunk Год назад

    label:active:after is not working

    • @hikari._.zasureiya1540
      @hikari._.zasureiya1540 Год назад +1

      use label::active instead of laber:active and replace ::active with every :active

  • @vnxcius
    @vnxcius 2 года назад

    pls make a version using js

    • @zishanchaudhary221
      @zishanchaudhary221 Год назад

      const toggle = document.querySelector("#darkmode-toggle");
      let bg = document.body;
      toggle.addEventListener("change", function () {
      if (this.checked) {
      // Toggle button is checked
      // Perform actions for the checked state
      bg.style.backgroundColor = "black";
      } else {
      // Toggle button is unchecked
      // Perform actions for the unchecked state
      bg.style.backgroundColor = "white";
      }
      });
      add these lines in a script tag and thats it.

  • @PutriAisyah-w6h
    @PutriAisyah-w6h 8 месяцев назад

    Oke gelap dan in the sun 1:31

  • @cuongie
    @cuongie 2 года назад +1

    TAYLOR CLASS TSKEOVER

  • @mirjalol_shamsiddinov
    @mirjalol_shamsiddinov 2 года назад

    just waw

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

    sir how to get svg code

  • @mraloush8959
    @mraloush8959 2 года назад

    this is so overdone lol. u dont know how to code. u can do the exact samt thing in 10 lines css.

    • @paulhamacher773
      @paulhamacher773 2 года назад

      What an arrogant comment. Every single line serves its specific purpose. To me you're just bullshitting here unless you prove otherwise.

    • @mraloush8959
      @mraloush8959 2 года назад

      @@paulhamacher773 u look like an npc

    • @paulhamacher773
      @paulhamacher773 2 года назад

      And now you can't even think of anything better than commenting on my appearance. Pathetic.

    • @scotfree7702
      @scotfree7702 Год назад +6

      10 lines, post them here then smart arse