Create title for two columns

Asked

Viewed 38 times

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>';

Upshot: inserir a descrição da imagem aqui

Now I want to create a title for the first two tables side by side and another for the other two, as shown in the image: inserir a descrição da imagem aqui

1 answer

4


To make a cell table occupy more than one column, you can use the attribute colspan. If you want to occupy more than one line, you can also use the 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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.