HTML Tables
HTML Tables are used to represent data in rows and columns.
In HTML, Tables are created using the <table>
tag, along with various other tags, like <tr>
, <th>
and <td>
. These tags respectively define the table row, table header and table data.
Table Rows
Table rows are specified with <tr>
tag. We can make infinite number of rows in a table, but in order to make a stunning table we must add fixed number of cells (columns) in each row.
Table Header
Table header is specified with <th>
tag. Everything between the <th>
…</th>
is the table header. Table header is somewhat bigger in size as compared to table data.
Table Cells
Table cells are specified with <td>
tag. Everything written between the <td>
…</td>
is actually the main content of a table.
In an Example below let’s write a code to create a simple HTML Table.
Example
<!DOCTYPE html> <html> <head> <title>HTML Tables</title> </head> <body> <h2>Create a simple HTML Table</h2> <table border=1px;> <tr> <th>Name</th> <th>Email</th> <th>Address</th> </tr> <tr> <td>Raju</td> <td>Raju@gmail.com</td> <td>India</td> </tr> <tr> <td>Musaib</td> <td>musa@gmail.com</td> <td>Iraq</td> </tr> <tr> <td>Umer</td> <td>umi@gmail.com</td> <td>Oman</td> </tr> </table> </body> </html>
Share This Post!
One thought on “HTML Tables”