Creating a Table in HTML

HTML tables are used to represent data in rows and columnsThey can display information like financial details, products and prices, employee salaries, and flight times and much more

Here is the code for the table that was created by my as a part learning html.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  th,
  td {
    padding: 15px;
  }
</style>

<body>
  <table border="3" cellpadding="2">
    <thead>
      <tr>
        <th>Time</th>
        <th>Room 1</th>
        <th>Room 2</th>
        <th>Room 3</th>
        <th>Room 4</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td rowspan="3">9:00 AM - 10:00 AM</td>
        <td rowspan="2">Keynote</td>
        <td>Session A</td>
        <td>Session B</td>
        <td rowspan="3">Session C</td>
      </tr>
      <tr>
        <td>Session D</td>
        <td>Session E</td>

      </tr>
      <tr>
        <td colspan="1">10:30 AM - 11:30 AM</td>
        <td colspan="2">Session F</td>
      </tr>
      <tr>
        <td>12:00 PM - 1:00 PM</td>
        <td colspan="4">Lunch Break</td>

      </tr>
      <tr>
        <td rowspan="2">1:00 PM - 2:00 PM</td>
        <td>Session G</td>
        <td rowspan="2">Session H</td>
        <td>Session I</td>
        <td>Session J</td>
      </tr>
      <tr>
        <td>Session K</td>
        <td>Session L</td>
        <td>Session M</td>

      </tr>
    </tbody>
  </table>
</body>

</html>

output was like this:




Post a Comment

0 Comments