Wednesday, 23 August 2023

Table tag in html

The <table> tag in HTML is used to create tables. Tables are used to display data in a tabular format. The <table> tag has several attributes that can be used to control the appearance and layout of the table.


 

The most common attributes of the <table> tag are:

  • border: This attribute specifies the thickness of the border around the table.
  • cellpadding: This attribute specifies the amount of space between the cell content and the cell borders.
  • cellspacing: This attribute specifies the amount of space between the cells.
  • width: This attribute specifies the width of the table.
  • height: This attribute specifies the height of the table.

The <table> tag can contain two types of elements: <tr> and <td>. The <tr> element is used to create a row in the table. The <td> element is used to create a cell in the table.

The <tr> element has several attributes that can be used to control the appearance and layout of the row. The most common attributes are:

  • bgcolor: This attribute specifies the background color of the row.
  • align: This attribute specifies the alignment of the text in the row.
  • valign: This attribute specifies the vertical alignment of the text in the row.

The <td> element has several attributes that can be used to control the appearance and layout of the cell. The most common attributes are:

  • bgcolor: This attribute specifies the background color of the cell.
  • align: This attribute specifies the alignment of the text in the cell.
  • valign: This attribute specifies the vertical alignment of the text in the cell.
  • width: This attribute specifies the width of the cell.
  • height: This attribute specifies the height of the cell.
Here is an example of how to use the <table> tag:

<table border="1" cellpadding="5" cellspacing="0">     <tr bgcolor="lightgray">         <td>Name</td>         <td>Age</td>         <td>Occupation</td>     </tr>     <tr>          <td>John Doe</td>         <td>30</td>         <td>Software Engineer</td>     </tr>     <tr>         <td>Jane Doe</td>         <td>25</td>         <td>Teacher</td>     </tr> </table>

out put

Name Age Occupation
John Doe 30 Software Engineer
Jane Doe 25 Teacher

No comments:

Post a Comment

Interactive Report: Introduction to the Internet of Things (IoT) ...

Popular Posts