HTML Table Tag is used for arranging the data in the form of rows and columns on the web page. It is a very useful feature. One another purpose of using a table is to create a page layout with the use of hidden tables.
Table can be created using <table> element in HTML. Alongwith table element, other elements used are <tr> which refers to a table row, <th> which refers to a table header and <td> which refers to a table cell/column.Syntax
Example
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
The below table contains Table Attributes and their description which is supported by HTML version.
Attribute Name | Attribute Value | Attribute Description |
---|---|---|
border | 0 or 1 | refers to whether the table cells have border or not |
bgcolor | color-name | refers to background color of the table |
cellpadding | pixels | refers to spacing between cell's wall & content |
cellspacing | pixels | refers to spacing between cells |
width | pixels or % | refers to width of a table |
align | left, center or right | refers to alignment of the table |
valign | top, middle,bottom | refers to vertical alignment of the table |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |
This will produce following result
Name | Subject | Marks |
---|---|---|
John | History | 79 |