How can I create this table with HTML?
I tried it but not sure how to do it correctly.
My code:
<table border=1 cellpadding=0 cellspacing=0>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan=2> </td>
<td> </td>
<td> </td>
</tr>
</table>
Use rowspan
and colspan
attributes.
The table has 3 columns (cells) and 3 rows:
<table>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" rowspan="2"> </td>
<td> </td>
</tr>
<tr>
<!-- <td> from prev <tr> here with colspan="2" and rowspan="2" -->
<td> </td>
</tr>
</table>
Make sure that every row (<tr>
) has always the same count of cells/columns (<td>
).
An <td>
with colspan="2"
counts as 2
.
<tr>
has 3 cells (1+1+1).<td>
from the previous <tr>
which has colspan="2"
and rowspan="2"
and the last <td>
element, so 3 cells (2+1)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With