Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

279
Visualizações
Stacking a div on overlap in react when div overflows in an HTML Table

I am building a resource/scheduling calendar app in react. I built it using an HTML table. The table is the grid for the calendar. Within the table cells, I have event divs that can be longer than the cell itself to represent the length of the event. Because of this, the events are overflowing the parent cell which works well. However if two events overlap each other on the same row, id like the divs to stack even if the divs are not within the same cell. Here is an example.

enter image description here

You can see in the image that the green and blue divs overlap but since they are in 2 different cells, they do not stack, they just overlap each other. Here is some example code:

<table>
  <tbody>
    <tr>
      <td>
        <CalendarEvent style={{width: "widthOfTwoCells"}} /> 
      </td>
      // This first div will overlap the 2nd 
      // since the width is as long as 2 cells. 
      <td>
        <CalendarEvent style={{width: "widthOfTwoCells"}} />
      </td>
      <td></td>
    </tr>
  </tbody>
</table>

This is pretty basic compared to whats there but I think it gets the issue across. Hoping there is a way to fix this with pure css or something without haviing to build a formula in JS that checks if they are colliding. Thanks for taking a look. Here is some extra CSS for the Cal Event div incase that helps.

.calendar-event {
  position: relative;
  height: 40px;
  z-index: 90;
  
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda