0

What I'm trying to do is, make a view exactly like table but with div what I did, use flex and calc() to make equal width between rows but first row should has different width (bigger than other) for this I used 100%/1 it working when it is empty but when it has content, not working anymore. See below example:

.tr {
    display: flex;
}

.tr .th,.tr .td {
    width: calc(100%/5);
    border: 1px solid blue;
}

.tr .th:first-child, .tr .td:first-child {
    width: calc(100%/1);
    border: 1px solid red;
}
<div class="tr">
  <div class="th">T</div>
  <div class="th">T</div>
  <div class="th">T</div>
  <div class="th">T</div>
  <div class="th">T</div>
</div>

<div class="tr">
  <div class="td">Bdddddddddddddddd    22323 23 </div>
  <div class="td">Bdddddd</div>
  <div class="td">Bdddddddddddd</div>
  <div class="td">Bdd</div>
  <div class="td">Bdddddddddddddd asd</div>
</div>

What I want to set equal width for all rows but first rows should has equal width but longer than other. In above example, as you see rows not equal.

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Jack The Baker
  • 1,781
  • 1
  • 20
  • 51

0 Answers0