<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Example of HTML Table</title> <style> table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid black; padding: 8px; } th { background-color: #f2f2f2; } </style> </head> <body> <h1>HTML Table Example</h1> <table> <caption>Employee Contact Information</caption> <tr> <th>Name</th> <th>Email</th> <th>Age</th> </tr> <tr> <td>Joy</td> <td>johndoe@example.com</td> <td>30</td> </tr> <tr> <td>Jane</td> <td>janedoe@example.com</td> <td>25</td> </tr> </table> </body> </html> |
Explanation of the Code
HTML Structure: The <!DOCTYPE html> and <html> tags, with the language attribute set to English, are the conventional beginnings of the document.
Head Section:
Body Section:
Table Structure:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Example of HTML Table</title> <style> table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid black; padding: 8px; } th { background-color: #f2f2f2; } </style> </head> <body> <h1>HTML Table Example</h1> <table> <caption>Employee Contact Information</caption> <tr> <th>Name</th> <th>Email</th> <th>Age</th> </tr> <tr> <td>Joy</td> <td>johndoe@example.com</td> <td>30</td> </tr> <tr> <td>Jane</td> <td>janedoe@example.com</td> <td>25</td> </tr> </table> </body> </html> |
Explanation of the Code
HTML Structure: The <!DOCTYPE html> and <html> tags, with the language attribute set to English, are the conventional beginnings of the document.
Head Section:
Body Section:
Table Structure:
Copyrights © 2024 letsupdateskills All rights reserved