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

194
Views
CSS Display InfoBox on hovering over <span> Element

I want to implement a functionality in my React app where you hover over a <span> element and then an InfoBox appears over the <span> element.

It should look like in Visual Studio code when you hover your cursor over a variable for example. VSCode on hover

The box should behave as in the following sketch I drew (basically it's the same behavior as in VSCode): The InfoBox is the box that contains This text. The <span> contains the hello

Sketch how the infoBox should behave

Unfortunately I'm not an expert in CSS and I don't even know if this is possible with CSS only or if you have to use javascript as well.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This might help:

.thisText{
  position:relative;
  top: 20px;
 }

.thisText > .hello{
  display: none;
}

.thisText:hover> .hello {
  display: block;
  position:absolute;
  top:-20px;
}

<span class="thisText">
This Text
  <span class="hello">
    Hello
  </span>
</span>
about 4 years ago · Juan Pablo Isaza Report

0

Is this what you are looking for?

Where you hover over some text and text below it appears?

.thisText > .hello {
  display: none;
}

.thisText:hover > .hello {
  display: block;
}
<span class="thisText">
This Text
  <span class="hello">
    Hello
  </span>
</span>

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!