Create title for two columns

0

I have this code to create the following tables side by side:

echo '<div><table border="1"><tr><td>';
echo '<div><table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Creche I Utentes</strong></h5></td> ';
echo $tabela1;
echo '<div><table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Creche II Utentes</strong></h5></td> ';
echo $tabela2;

echo "</td><td>";

echo '<div><table border="1" style="width:150px"> <td ><h5><strong>Total de Refeições Infância Utentes</strong></h5></td> ';
echo $tabela3;
echo '<div><table border="1" style="width:150px"> <td ><h5><strong>Total de Refeições Infância Colaboradores</strong></h5></td> ';
echo $tabela4;

echo "</td><td>";

echo '<table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Centro de Dia Utentes</strong></h5></td> ';
echo $tabela5;
echo '<table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Centro de Dia Colaboradores</strong></h5></td> ';
echo $tabela6;

echo "</td><td>";

echo '<table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Lar Utentes</strong></h5></td> ';
echo $tabela7;
echo '<table border="1" style="width:150px"> <td style="width:20px; text-align: center"><h5><strong>Total de Refeições Lar Colaboradores</strong></h5></td> ';
echo $tabela8;

echo '</td></tr></table></div>';

Result:

NowIwanttocreateatitleforthefirsttwotablessidebysideandanotherfortheothertwo,asIshowintheimage:

    
asked by anonymous 03.05.2018 / 10:10

1 answer

4

To make a cell table occupy more than one column, you can use the colspan attribute % . If you want it to occupy more than one line, you can also use rowspan , as shown in the example below.

<table border="1">
  <tr>
    <th colspan="2">Senior</th>
  </tr>
  <tr>
    <td rowspan="2">A</td>
    <td>B</td>
  </tr>
  <tr>
    <td>C</td>
  </tr>
</table>
    
03.05.2018 / 10:39