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

274
Views
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
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!