HTML Table

Tables are defined by using the <table> tag. Tables are divided into table rows with the <tr> tag. Table rows are divided into table columns (table data) with the <td> tag.

Code Structure:
<table border="1">
    <tr>
        <td>Mazda</td>
        <td>Audi</td>
        <td>BMW</td>
    </tr>
    <tr>
        <td>Toyota</td>
        <td>Mercedes</td>
        <td>Ferrari</td>
    </tr>
</table>

Using table with colspan

Code Structure:
<table border="1">
    <tr>
        <td>Mazda</td>
        <td>Audi</td>
        <td>BMW</td>
    </tr>
    <tr>
        <td>Toyota</td>
        <td colspan="2">Mercedes</td>
    </tr>
</table>

Using table with rowspan

Code Structure:
<table border="1">
    <tr>
        <td rowspan="2">Mazda</td>
        <td>Audi</td>
        <td>BMW</td>
    </tr>
    <tr>
        <td>Toyota</td>
        <td>Mercedes</td>
    </tr>
</table>

Share this

Related Posts