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

244
Views
React / CSS, actively syncing one component's location to match another component's location in a webpage

I'm currently studying react and want to build a timetable project. I have built a timetable using simple html tables like this:

<tbody>
   <tr>
       <td> </td>
       <td> </td>
        ....
   </tr>
   ...
</tbody>

And I want to add a event as a sibling of that table, with code like

<div className="card"
style = {{color: "red", width: "18rem", height: "10rem", zIndex:0, position: "absolute", top: "20%", left: "10%"}}
> some event</div>

And I indeed achieve the result like the image attached (the red box are for demonstration of each cell in a table).

However, I have a problem, the "some event" box's top left corner should be at the exact same location as the box1 (the cell in the table). I think it is possible by assigning the exact same top left css value as the "box 1" cell. However, when the page's size changes, the cell "box 1" 's location will change, and will result in a mismatch between the "some event" box's location and the "box 1" 's location.

Thus, my question is: is there a way, either in css, or using some state function, to actively sync one component's location exactly as the other. I have searched for a long time but barely found one answer. Any suggestions help!

enter image description here

about 4 years ago · Santiago Gelvez
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!