Learn HTML Tables(v5) with Best Examples

In this tutorial, I will take you through the usage of html tables with best examples.

What is table?

A table is an arrangement of data in rows and columns, or possibly in a more complex structure. Tables are widely used in communication, research, and data analysis.
a)Tables are useful for various tasks such as presenting text information and numerical data.
b)Tables can be used to compare two or more items in tabular form layout.
c)Tables are used to create databases.

What is HTML tables?

An HTML table is defined with the “table” tag. Each table row is defined with the “tr” tag. A table header is defined with the “th” tag. By default, table headings are bold and centered. A table data/cell is defined with the “td” tag.

Learn HTML Tables(v5) with Best Examples 1

Example

<!DOCTYPE html> 
<html> 
   <body> 
     <table style="width:100%"> 
       <tr> 
         <th>Firstname</th> 
         <th>Lastname</th> 
         <th>Age</th> 
       </tr> 
       <tr> 
         <td>John</td> 
         <td>Smith</td> 
         <td>44</td> 
       </tr> 
       <tr> 
         <td>Charles</td> 
         <td>Darwin</td> 
         <td>22</td> 
       </tr> 
       <tr> 
         <td>Todd</td> 
         <td>Pickett</td> 
         <td>31</td> 
       </tr> 
     </table> 
   </body> 
</html>

Output

FirstnameLastnameAge
JohnSmith44
CharlesDarwin22
ToddPickett31

Also Read: Top AWS Interview Questions

References: More info on HTML

Advertisements

Leave a Reply