Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

391
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda