HTML Table Tag (<table>)

The HTML Table tag (<table>)is used to organize information in an irregular format — rows and columns, just like you would in a spreadsheet.Tables are very helpful if you need to present structured data in a clear and easy way .

Main Table Tags

  • <table> – Starts the table.
  • <tr> – Table row (each vertical row).
  • <th> – Table heading (bold & centered by disclaimer).
  • <td> – Table data cell (holds factual data).

Example

                    
                    <table border="1">
                      <tr>
                        <th>Name</th>
                        <th>Age</th>
                        <th>City</th>
                        <th>Email</th>
                        <th>Course</th>
                      </tr>
                      <tr>
                        <td>Rahul</td>
                        <td>22</td>
                        <td>Delhi</td>
                        <td>rahul@example.com</td>
                        <td>BCA</td>
                      </tr>
                      <tr>
                        <td>Anjali</td>
                        <td>20</td>
                        <td>Mumbai</td>
                        <td>anjali@example.com</td>
                        <td>BSc IT</td>
                      </tr>
                      <tr>
                        <td>Vikram</td>
                        <td>23</td>
                        <td>Bangalore</td>
                        <td>vikram@example.com</td>
                        <td>B.Tech</td>
                      </tr>
                      <tr>
                        <td>Priya</td>
                        <td>21</td>
                        <td>Kolkata</td>
                        <td>priya@example.com</td>
                        <td>BCA</td>
                      </tr>
                      <tr>
                        <td>Sachin</td>
                        <td>24</td>
                        <td>Chandigarh</td>
                        <td>sachin@example.com</td>
                        <td>MCA</td>
                      </tr>
                      <tr>
                        <td>Neha</td>
                        <td>22</td>
                        <td>Jaipur</td>
                        <td>neha@example.com</td>
                        <td>BSc CS</td>
                      </tr>
                      <tr>
                        <td>Aman</td>
                        <td>25</td>
                        <td>Lucknow</td>
                        <td>aman@example.com</td>
                        <td>MBA</td>
                      </tr>
                      <tr>
                        <td>Kritika</td>
                        <td>19</td>
                        <td>Indore</td>
                        <td>kritika@example.com</td>
                        <td>BA</td>
                      </tr>
                      <tr>
                        <td>Mohit</td>
                        <td>20</td>
                        <td>Bhiwani</td>
                        <td>mohitkumar@gmail.com</td>
                        <td>BCA</td>
                      </tr>
                    </table>
                    
                    

Preview :

Name Age City Email Course
Rahul 22 Delhi rahul@example.com BCA
Anjali 20 Mumbai anjali@example.com BSc IT
Vikram 23 Bangalore vikram@example.com B.Tech
Priya 21 Kolkata priya@example.com BCA
Sachin 24 Chandigarh sachin@example.com MCA
Neha 22 Jaipur neha@example.com BSc CS
Aman 25 Lucknow aman@example.com MBA
Kritika 19 Indore kritika@example.com BA
Mohit 20 Bhiwani mohitkumar@gmail.com BCA

(This image here showing a basic HTML table with rows and columns for Name, Age, City, Email, and Course, populated with the data from the example.)

Extra tags (voluntary but Useful)

  • <thead> – Groups the heading content.
  • <tbody> – Groups the main body content.
  • <tfoot> – Groups the footer content.
  • colspan and rowspan – combine columns and rows.

Tables help in organizing complex data. Use them wisely and apply CSS for better design and responsiveness.