Search code examples
htmltwitter-bootstraprowhtml-tablecol

Nested HTML table


I need to make the next Theader in HTML

http://puu.sh/bU2Fn/2e26a2591c.jpg

The problem is i am currently stuck when it come to "level 3 menu" like in "plan familiar - Citol"

This is what i currently got:

http://puu.sh/bU2WN/58872a7f57.png

    <table class="table table-bordered table-condensed table-responsive">

  <tr>
    <th rowspan="2">N°</th>
    <th rowspan="2">Nombres y apellidos</th>
    <th rowspan="2">Edad</th>
    <th rowspan="2">Cedula</th>
    <th colspan="6">Plan familiar</th>
    <th rowspan="2">N° gesta</th>
    <th colspan="16">Control prenatal</th>
    <th colspan="8">Control Post-natal</th>
  </tr>

<tr>

<th>
<td>P</td>
<td>S</td>
<td>G.O</td>
<td>DIU</td>
<td>Citol</td>
</th>

<th>
    <td>P</td>
    <td><13 Sem</td>
    <td>>13Sem</td>
    <td><19 años</td>
    <td>>19 años</td>
    <td>sem gesta</td>
    <td>S</td>
    <td>ARO</td>
    <td>VDLR</td>
    <td>HIV</td>
    <td>Citol</td>
    <td>Pat</td>
    <td>Acid Fol</td>
    <td>Sulf Fer</td>
    <td>Poli vit</td>
</th>



<th>
    <td>P</td>
    <td><7 D</td>
    <td>>8 D</td>
    <td>S</td>
    <td>Acid Fol</td>
    <td>Sulf Fer</td>
    <td>Poli vit</td>
</th>


  </tr>

</table>

Solution

  • Well, your question has nothing to do with Bootstrap, but here you go:

    <table class="table table-bordered table-condensed table-responsive">
        <tr>
            <th rowspan="2">N°</th>
            <th rowspan="2">Nombres y apellidos</th>
            <th rowspan="2">Edad</th>
            <th rowspan="2">Cedula</th>
            <th colspan="6">Plan familiar</th>
            <th rowspan="2">N° gesta</th>
            <th colspan="16">Control prenatal</th>
            <th colspan="8">Control Post-natal</th>
        </tr>
        <tr>
            <td>P</td>
            <td>S</td>
            <td>G.O</td>
            <td>DIU</td>
            <td>Citol
                <table>
                    <tr>
                        <td>P</td>
                        <td>S</td>
                    </tr>
                </table>
            </td>
            <td>P</td>
            <td>13 Sem</td>
            <td>13Sem</td>
            <td>19 años</td>
            <td>19 años</td>
            <td>sem gesta</td>
            <td>S</td>
            <td>ARO</td>
            <td>VDLR</td>
            <td>HIV</td>
            <td>Citol</td>
            <td>Pat</td>
            <td>Acid Fol</td>
            <td>Sulf Fer</td>
            <td>Poli vit</td>
            <td>P</td>
            <td>7 D</td>
            <td>8 D</td>
            <td>S</td>
            <td>Acid Fol</td>
            <td>Sulf Fer</td>
            <td>Poli vit</td>
        </tr>
    </table>
    

    I have also added some CSS if you want to check and play around, but of course, it's on you and you can modify at will