Home > OS >  I need help to split a cell into two columns
I need help to split a cell into two columns

Time:09-19

Just like how in the image I linked "tache1" and "tache2" in the 4th row are splitting "Mercredi" in two

Goal

<table width="400" border="2" cellspacing="1" cellpadding="1">
  <tr>
    <th width="15%" rowspan="2">Equipes</th>
    <th width="70%" colspan="5">Janvier</th>
    <td width="15%" rowspan="2"></td>
  </tr>
  <tr>
    <th>Lundi</th>
    <th>Mardi</th>
    <th>Mercredi</th>
    <th>Jeudi</th>
    <th>Vendredi</th>
  </tr>
  <tr>
    <td rowspan="2">Equipe1</td>
    <td colspan="3">tache1</td>
    <td colspan="2">tache2</td>
    <td rowspan="2">Semaine1</td>
  </tr>
  <tr>
    <td colspan="2">tache1</td>
    <td colspan="3">tache2</td>
  </tr>
</table>

CodePudding user response:

Use 6 colspan instead of 5 in <th width="70%" colspan="6">Janvier</th> Then use 2 colspan for Mercredi like this <th colspan="2">Mercredi</th> Then use 3 colspan for each tache like this

 <td colspan="3">tache1</td>
 <td colspan="3">tache2</td>

Also In your setup, Equip1 is taking 2 rows but its content to the right take only 1 row.

so use rowspan"1" for both Equipe1 and 2.

<table width="600" border="2" cellspacing="1" cellpadding="1">
    <tr>
      <th width="15%" rowspan="2">Equipes</th>
      <th width="70%" colspan="6">Janvier</th>
      <td width="15%" rowspan="2"></td>
    </tr>
    <tr>
      <th>Lundi</th>
      <th>Mardi</th>
      <th colspan="2">Mercredi</th>
      <th>Jeudi</th>
      <th>Vendredi</th>
    </tr>
    <tr>
      <td rowspan="1">Equipe1</td>
      <td colspan="3">tache1</td>
      <td colspan="3">tache2</td>
      <td rowspan="2">Semaine1</td>
    </tr>
    <tr>
      <td rowspan="1">Equipe2</td>
      <td colspan="3">tache1</td>
      <td colspan="3">tache2</td>
    </tr>
  </table>

  • Related