Tables in html (lt.9)

·

1 min read

Tables in HTML are used to display data in a tabular format. They consist of rows and columns

code to demonstrate it:

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

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=\, initial-scale=1.0" />
  <title>BLOCK AND TITLE</title>
</head>

<body>


<!-- getting table and its  properties -->

  <table border cellpadding="10px" bordercolor="red">

    <!-- padding means to give space from inside -->
    <!-- margin means to give space from outside -->

    <!-- tr - table row -->
    <tr>

      <!-- th - table heading -->
      <th>sr . no</th>
      <th>name</th>
      <th>subject</th>
    </tr>
    <tr>
      <!-- td - table data -->
      <td>1</td>
      <td>gopal</td>
      <td>english</td>

    </tr>
    <tr>
      <td>2</td>
      <td rowspan="2">row</td>
      <td>maths</td>
    </tr>
    <tr>
      <td>3</td>
<!--  colspan means giving same values to more than one row or column-->
      <td colspan="2">hello</td>
      <!-- <td rowspan="2">hello</td> -->
    </tr>
  </table>
</body>

</html>

lt.8 : https://hashnode.com/post/clnxfm0aj000309iaagyn8jtd