HTML Tables Examples




HTML Tables Examples

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Table </title>
   </head>
   <body>
   <table style="width:100%" border="2px">
      <tr>
         <th>Name</th>
         <th colspan="2">cell phone</th>
      </tr>
      <tr>
         <td>Saharaukh</td>
         <td>66644973</td>
         <td>23452397</td>
      </tr>
      <tr>
         <td>Salman</td>
         <td>66644973</td>
         <td>23452397</td>
      </tr>
      <tr>
         <td>Amir</td>
         <td>66644973</td>
         <td>23452397</td>
      </tr>
      <tr>
         <td>Akshay</td>
         <td>66644973</td>
         <td>23452397</td>
      </tr>
      <tr>
         <td>Amit</td>
         <td>66644973</td>
         <td>23452397</td>
      </tr>
   </table>
</body>
</html>

Output

Table Border Examples

<!DOCTYPE html>
<html>
   <head>
      <title>Table Border Example</title>
   </head>
   <body>
      <table border="2">
         <tr > 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell one</td> 
            <td>cell two</td> 
         </tr>
         <tr> 
            <td>cell three</td> 
            <td>cell four</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr > 
            <td>cell one</td> 
            <td>cell two</td>
            <td>cell one</td> 
            <td>cell two</td>				
         </tr>
         <tr> 
            <td>cell three</td> 
            <td>cell four</td> 
            <td>cell three</td> 
            <td>cell four</td>
         </tr>
         <tr > 
            <td>cell one</td> 
            <td>cell two</td>
            <td>cell one</td> 
            <td>cell two</td>				
         </tr>
         <tr> 
            <td>cell three</td> 
            <td>cell four</td>
            <td>cell three</td> 
            <td>cell four</td>				
         </tr>
      </table>
   </body>
</html>

Output

Table Heading Examples

<!DOCTYPE html>
<html>
   <head>
      <title>Table Heading Example</title>
   </head>
   <body>
      <table>
         <tr> 
            <th>Column One</th> 
            <th>Column two</th>
            <th>Column three</th>
            <th>Column four</th>
         </tr>	
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
         <tr> 
            <td>cell one</td> 
            <td>cell two</td> 
            <td>cell three</td> 
            <td>cell four</td> 
         </tr>
      </table>
   </body>
</html>

Output

Table Colspan Examples

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Table Colspan/Rowspan</title>
   </head>
   <body>
      <table border = "1">
         <tr>
            <th>Column 1</th>
            <th>Column 2</th>
            <th>Column 3</th>
         </tr>
         <tr>
            <td rowspan = "2">Row 1 Cell 1</td>
            <td>Row 1 Cell 2</td>
            <td>Row 1 Cell 3</td>
         </tr>
         <tr>
            <td>Row 2 Cell 2</td>
            <td>Row 2 Cell 3</td>
         </tr>
         <tr>
            <td colspan = "3">Row 3 Cell 1</td>
         </tr>
      </table>
   </body>
</html>

Output