HTML Table

Subject: Introduction to HTML and Web Technology



An HTML table is a structure used to organize and display data in a grid format on a web page. It consists of rows and columns, where rows run horizontally, and columns run vertically. Tables are created using HTML tags, with the main tags being:

<table> : This tag defines the entire table.
<tr> : Stands for "table row" and is used to define a row within the table.
<td> : Represents a "table data" cell and is used to define individual data cells within a row.
<th> : Represents a "table header" cell and is used to define header cells, typically found at the beginning of each column or row. They are usually bold and centered by default.

Here's a basic example of an HTML table:

<h2>Students Record</h2>
<table border=1>
  <tr>
    <th>Number</th>
    <th>Full name</th>
    <th>Course</th>
  </tr>
  <tr>
      <td>1</td>
    <td>Chinyere</td>
    <td>Data Science</td>    
  </tr>
  
  <tr>
      <td>2</td>
    <td>Kunle</td>
    <td>Web Design</td>    
  </tr>
  
  <tr>
      <td>3</td>
    <td>Ahmed</td>
    <td>Programming</td>    
  </tr>
  
   <tr>
      <td>4</td>
    <td>Femi</td>
    <td>Machine Learning</td>    
  </tr>
  
</table>


In this example, we have a simple table of students with five rows and three columns. The <th> tags represent headers, and the <td> tags represent data cells.I make the border thickness to be 1 so that the border line can be visible, HTML tables can be further customized with attributes like border, cellpadding, and cellspacing to control the table's appearance and spacing.

Tables are commonly used to present structured data, such as schedules, pricing information, or data comparisons on websites. However, for more complex layouts and responsiveness, CSS and other layout techniques are often used in combination with tables.

By: Benjamin Onuorah

Comments

No Comment yet!

Login to comment or ask question on this topic


Previous Topic Next Topic

Supported by