A table is an orderly arrangement of vertical columns and horizontal rows.
Tables with Border Attribute
A Table can be created in the HTML with the <table> tag. A table is the collection of rows (<tr> tag), and each row is the collection of data cells (<td> tag). td stands for "table data", which is the content of a data cell. A data cell can contain data like text, images, forms, tables, etc.
Example of Creating Table :-
<table border="2">
<tr>
<td>This is row 1, cell 1</td>
<td>This is row 1, cell 2</td>
</tr>
<tr>
<td>This is row 2, cell 1</td>
<td>This is row 2, cell 2</td>
</tr>
</table>
Output :-

If you need a table without border then there is no need to specify a border attribute. To display a table with border you have to specify the border attribute.
<th> tag
<th> tag is used for defining the headings in the table.
Example :-
<table border="2">
<tr>
<th>My First Heading</th>
<th>My Second Heading</th>
</tr>
<tr>
<td>This is row 1, cell 1</td>
<td>This is row 1, cell 2</td>
</tr>
<tr>
<td>This is row 2, cell 1</td>
<td>This is row 2, cell 2</td>
</tr>
</table>
Output :-

Table Tags with attributes
| Tag |
Attribute |
Description |
| <table> |
|
Defines a table that can contain any no. of rows(<tr> tags). |
|
border |
Indicates the width in pixels of the table borders. |
|
cellspacing |
Space between the cells in the table. |
|
cellpadding |
Space between the edges of the cells and its contents. |
|
width |
The width of the table on the page in either pixel values or as a percentage of page width. |
|
bgcolor |
Background color of all cells in the table. |
| <tr> |
|
Defines a table row, containing one or more cells(<td> tag) |
|
align |
The horizontal alignment of the contents of the cells within this row. Possible values are left, right and center. |
|
valign |
The vertical alignment of the contents of the cells within this row. Possible values are top, middle and bottom. |
|
bgcolor |
Background color of all cells in the row that do not contains their own background or bgcolor attributes. |
|
background |
Background image to tile within all cells in the row that do not contain their own background or bgcolor attributes. |
| <td> |
|
Defines a table data cell. |
|
align |
The horizontal alignment of the contents of the cells within this row. Possible values are left, right and center. |
|
valign |
The vertical alignment of the contents of the cells. Possible values are top, middle and bottom. |
|
rowspan |
The number of rows this cell will span. |
|
colspan |
The number of columns this cell will span. |
|
width |
The width of this column of cells, in exact pixel values or as a percentage of table width. |
| <th> |
|
Defines a table heading cell. |
| <thead> |
|
Defines a table head. |
| <col> |
|
Defines the attribute values for one or more columns in a table |
| <tbody> |
|
Defines a table body. |