Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

390
Views
Button:active state changes size of button after toggling text?

I have a bootstrap button that toggles some CSS designs for my website when clicked. I am using it to change the background of the website via some simple JS to toggle the class. However, when the button is :active, I get really weird behaviour where it changes the size and color of my button.

If the button is black and large, on active it shrinks to small and white. When you click off, it returns to the correct state.

SASS file

.dark-mode
    #Homepage //ID for div that holds all elements on this page
       background: #202020
       color: white
    .press // ID for custom buttons
       color: white
    .press:hover
       color: white
       text-shadow: 2px 3px 5px #d3d3d3ab
    .quote-widget //custom element
       color: black
       background: #e6e6e6c7

react js file

 /* toggleTheme() function which will change between light and dark mode */
  function toggleTheme() {
    var el = document.body;
    el.classList.toggle("dark-mode"); // toggle class of object with corresponding class
  }

//inside the functional component:

{/* Toggle theme button */}
        <div className='theme-widget'>
          <button onClick={toggleTheme} id="swap" className="toggle-theme">{'\u25D1'}</button>
        </div>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!