HTML Tables

HTML Tag

  • <table> element to define a table
  • <tr> element to define a table row
  • <td> element to define a table data
  • <th> element to define a table heading
  • <caption> element to define a table caption

CSS Attributes

  • border property to define a border
  • border-collapse property to collapse cell borders
  • padding property to add padding to cells
  • CSS text-align property to align cell text
  • border-spacing property to set the spacing between cells
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
             border: 1px solid black;
             border-collapse: collapse;
}
th, td {
             padding: 5px;
             text-align: left;
}
</style>
</head>
<body>
<h2>Employee Details</h2>
<table style=”width:100%”>
             <tr>
                         <th>Firstname</th>
                         <th>Lastname</th>
                         <th>Age</th>
             </tr>
             <tr>
                         <td>Ramesh</td>
                         <td>Sharma</td>
                         <td>50</td>
             </tr>
             <tr>
                         <td>Pooja</td>
                         <td>Verma</td>
                         <td>27</td>
             </tr>
             <tr>
                         <td>Jhanavi</td>
                         <td>Patel</td>
                         <td>29</td>
             </tr>
</table>
</body>
</html>

 

 
also see

C Programming language
Go Programming language
Linked List Array
Stack Queue
Puzzle Reasoning
Aptitude Simplification
Previous articleDisplaying Images in HTML
Next articleSearch an Element in a Linked List

LEAVE A REPLY

Please enter your comment!
Please enter your name here