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

191
Vistas
Hovering not working while displaying an element on hovering another button

Intro

I am having a color palette. I wanted to display a tooltip whenever I hover that button. But when I hover over them , it is not.

I am using ReactJS and css for styling.

So this is the color palette and I want to display the tooltip whenver someone hovers any button.

cp

Now I followed upto 2nd answer here. But it is not working.

Code

App.js

themeList.map((t, k) => (
      <button
        key={k}
        id="theme_color_btn"
        data-theme={t}
        onKeyDown={this.keyboardNavigation}
        className={`theme-button bg-${t}-500${theme === t ? " is-active" : ""}`}
        onClick={this.changeTheme}
      >
        <div
          id="tooltip"
          className={`bg-${t}-100 absolute text-${t}-900 text-sm p-1 rounded-md ring-1 ring-purple-900 z-10 mt-3 transition-transform capitalize `}
        >
          {t}
        </div>
      </button>

where const themeList = [ "indigo", "yellow", "red", "purple", "pink", "blue", "green", ]; index.css

#theme_color_btn{
  display:block;
}

#theme_color_btn:hover + #tooltip{
  display:block; 
  z-index:5;
  background-color:gray;
}

#tooltip {
  display:none ;
}

Instead,no tooltips are displaying on hover.

For Full code refer index.css and App.js files here

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Just remove the plus

#theme_color_btn:hover #tooltip{
   display:block; 
   z-index:5;
   background-color:gray;
 }

Hope this works

about 4 years ago · Juan Pablo Isaza Denunciar

0

You wrote #theme_color_btn:hover + #tooltip but the + operator is used for "the next element" but #tooltip is inside #theme_color_btn ...

So you should write something like

#theme_color_btn:hover #tooltip

or

#theme_color_btn:hover > #tooltip

Look here: Css selectors

about 4 years ago · Juan Pablo Isaza Denunciar

0

Use this css structure. This will work for sure

#theme_color_btn:hover{
&#tooltip{
  display:block; 
  z-index:5;
  background-color:gray;
}
}

#tooltip {
  display:none ;
}
about 4 years ago · Juan Pablo Isaza Denunciar
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