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

252
Vistas
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
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