Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make two columns in one <td> cell? [duplicate]

I'm trying to create two columns in one <td> cell while leaving the rest of the table intact.

Here is a sample of what I'm trying to do enter image description here

Here is a codepen with my table:

https://codepen.io/akamali/pen/XBVxxZ

I have tried to get it with colspan and add two columns <tr> inside but the result is always uneven. I also tried to add a table but did not look good at all. Any ideas?

like image 517
user2398069 Avatar asked Dec 24 '22 05:12

user2398069


1 Answers

Use colspan as follows:

.table {
  width: 100%;
  background-color: #ffffff;
  border: 4px solid #979797;
}

.table td {
  border-right: 2px solid #979797;
  border-bottom: 4px solid #979797;
  padding: 50px;
  height: 10px;
}

.table td:nth-child(3n+0) {
  border-right: 4px solid #979797;
}

.table td:last-child {
  border-right: none;
}

.table tr:last-child td {
  border-bottom: none;
}
<div>
  <table class="table">
    <tr>
      <th></th>
      <th></th>
      <th></th>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td colspan="2"></td>
      <td colspan="2"></td>
      <td colspan="2"></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td colspan="2"></td>
      <td colspan="2"></td>
      <td colspan="2"></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td colspan="3"></td>
      <td colspan="3"></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </table>
</div>
like image 186
j08691 Avatar answered Dec 28 '22 23:12

j08691