2

I have 2 css files for light mode & dark mode of the website
light.css & dark.css in the same directory.

<nav class="nav-menu">
      <ul>
        <li class="active"><a href="#intro"><i class="bx bx-home"></i> <span>Home</span></a></li>
        <li><a href="#button"><i class="bx bx-button"></i> <span>Toggle</span></a></li>
      </ul>
    </nav>

I have already integrated the light mode css file in the HTML. How can I use the

<li><a href="#button"><i class="bx bx-button"></i> <span>Toggle</span></a></li>

toggle icon to switch to dark mode css file in my website ?

5
  • stackoverflow.com/questions/2685614/… Commented Aug 23, 2020 at 16:32
  • switch on what?click event? Commented Aug 23, 2020 at 16:32
  • or this will help you - stackoverflow.com/questions/5680657/adding-css-file-with-jquery/… Commented Aug 23, 2020 at 16:40
  • @Tawsif I want to toggle between my lightmode & darkmode for my website when I click using the toggle icon. I have created separate css files for both modes. Now I want to just click on the toggle icon so that my website becomes dark mode. Commented Aug 24, 2020 at 10:32
  • @sergeykuznetsov I want to toggle between my lightmode & darkmode for my website when I click using the toggle icon. I have created separate css files for both modes. Now I want to just click on the toggle icon so that my website becomes dark mode. I feel the following does not align well with my doubt . Commented Aug 24, 2020 at 10:33

1 Answer 1

0

Add a specific id for the css link and change the value of the attribute href when trigger your selected button using javascript/jQuery.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.