Table in HTML

More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test

Table is an important componant for website.

table-pic here

Let's see the basic output of a table and try to learn all about table.
Here is an example of HTML table.


The best all-rounder in the world
Name Age Country position
Sakib-Al-Hasan 24 Bangladesh First
Mohammad Hafiz 25 Pakistan Secound
Shen Watson 28 Australia Third
TM Dilsan 27 Sri-Lanka Fourth
Sures Raina 29 India Fifth


Table is done with the <table> tag, there is a openning and a closing tag <table> and </table>.
In between <table> and </table> tags are the table row tags <tr> </tr>.
The table rows are divided into table data with the <td> tag and they are also divided into table heading with the <th> tag. We can add a border to a table with the border attribute.
The table will be displayed without border if it does not specify a border for the table.
We can add a caption to a table with the caption tag.
We should be remembered that the <caption> tag always kept to place immediately after the <table> tag.

How to create a table in HTML?


Let's try to create a table and have a look how the browser display it.

HTML Editor

<html>
<body>
<table width="400" border="1">
<tr>
<th> Name </th>
<th> Age </th>
<th> Country </th>
<th> Position </th>
</tr>
<tr>
<td> Sakib-Al-Hasan </td>
<td> 23 </td>
<td> Bangladesh </td>
<td> First </td>
</tr>
<tr>
<td> Mohammad Hafiz </td>
<td> 28 </td>
<td> Pakistan </td>
<td> Secound </td>
</tr>
<tr>
<td> Shen Watson </td>
<td> 27 </td>
<td> Australia </td>
<td> Third </td>
</tr> </table>
</body>
</html>

Web Browser
Name Age Country Position
Sakib-Al-Hasan 23 Bangladesh First
Mohammad Hafiz 28 Pakistan Secound
Shen Watson 27 Australia Third

More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test