Tables in HTML

HTML tables were created for instances when you need to add tabular material means when you want to show data in row and column form which is automatically set on the web page in the form of table to a web page. Table are very useful in html and many other languages. In HTML Table may be used to organize calendars, schedules, statistics, or other types of information, Note that “data” doesn’t necessarily mean numbers. A table cell may contain any sort of information, including numbers, text elements, and even images and multimedia objects.

Basic example of HTML Table

<table> 
  <tr>
    <th>Name</th> 
    <th>RollNo</th> 
    <th>Age</th>
  </tr> 
  <tr> 
    <td>Irfan</td> 
    <td>1234</td> 
    <td>16</td> 
  </tr> 
  <tr> 
    <td>Farhan</td> 
    <td>6789</td>
    <td>20</td>
 </tr>
</table> 
    

Output of above code

Name RollNo. Age
Irfan 1234 16
Farhan 6789 20


Explanation of table structure

<table> ... </table>

As in above example you saw, there is a table with three rows and three coloumns.A table is basically consists on rows and coloumns. So when user need to show data in tabular form it uses table tag.

<tr> ... </tr>

As in above example you saw, there is a table with three rows and three coloumns. An there are "tr" tags in between table tag. These "tr" tags are basically used to show rows in a table.

<th> ... </th>

As in above example you saw, there is a table with three rows and three coloumns. An there are "th" tags in between tr tag. These "th" tags are basically used to show header cell in a table.

<td> ... </td>

As in above example you saw, there is a table with three rows and three coloumns. An there are "td" tags in between tr tag. These "td" tags are basically used to show coloumns in a table.








The Best

Comment here

If you have any query, if you want to know something about any of technical course related to computer science field, if you have any suggestion about relevant to uploaded content or if you anything wrong here (any mistake in content) than please contact us. Keep in mind, comment should be according to community guidelines.