HTML CSS IMAGES LINKS
 
HTML → The very basic table

There are three basic units in any table:

  • table
  • table row
  • table cell

The tags for these are:

  • <table>
  • <tr>
  • <td>

First, we are declaring a <table>.
Inside the table, we create a table row <tr>.
Inside the table row, we create a table data or a cell <td>.

A <td> is always enclosed in a <tr>, which is always enclosed in a <table>.

Here is an example:

Cell ONE Cell TWO
Cell THREE Cell FOUR

And here's the code:

<table border="0">
<tr>
<td>Cell ONE</td>
<td>Cell TWO</td>
</tr>
<tr>
<td>Cell THREE</td>
<td>Cell FOUR</td>
</tr>
</table>

Note that the first <table> tag has the attribute called "border."

You can specify the width of the border.

Cell ONE Cell TWO
Cell THREE Cell FOUR

And here's the code:

<table border="1">
<tr>
<td>Cell ONE</td>
<td>Cell TWO</td>
</tr>
<tr>
<td>Cell THREE</td>
<td>Cell FOUR</td>
</tr>
</table>

When coding your tables it is advised to assign a value of 1 to the border attribute. Turning the border "on", will make the process of troubleshooting your code easier. Once you completed coding the table you may assign its border attribute a value of "0" to hide its borders.



 
  back ↑