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

198
Views
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 answers
Answer question

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 Report

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 Report

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 Report
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!