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

145
Views
element shifts when span appears in react

Im currently using React and rendering a span whenever a user hovers over the text element. The issue is that the existing text will shift leftwards(span will appear right of the text), whenever the span appears. Expected behavior is for the span to just appear on right of the text without shifting the text. Is there any way I can do this with css? Please see below for code:

<TableCell 
  classes={{ root: classes.tableCell }} 
  onMouseEnter={() => this.handleMouseEnter(index)} 
  onMouseLeave={() => this.handleMouseLeave(index)} 
  align="center">
      Hello
      {(isHovering) && <span>{this.getTitle(movie.title)} />}
 </TableCell>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like you're missing the closing tag of your span.

Try this:

<TableCell
                                classes={{ root: classes.tableCell }}
                                onMouseEnter={() => this.handleMouseEnter(index)}
                                onMouseLeave={() => this.handleMouseLeave(index)}
                                align="center">
                                Hello
                                {(isHovering) && <span>{this.getTitle(movie.title)} </span>}
 </TableCell>
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!