Advertisement

Responsive Advertisement

Table Tags and It`s Attributes

HTML Table Tags with Header Image
Header Image

HTML Table Tags and Header Image

Table Tags in HTML

HTML provides several tags that are used to structure data in a tabular format. Here's a breakdown of these tags:

<table>

The <table> tag is used to define the entire table structure.

<tr>

The <tr> tag is used to define a row in the table. It contains one or more table cells (either <th> or <td>).

<th>

The <th> tag defines a header cell in the table. The text inside <th> is typically bold and centered by default. It is used for column or row headings.

<td>

The <td> tag defines a standard data cell in a table. The text inside <td> is aligned to the left by default.

<caption>

The <caption> tag provides a title or description for the table. This is placed above the table by default.

<thead>, <tbody>, <tfoot>

The <thead>, <tbody>, and <tfoot> tags are used to group table header, body, and footer sections respectively. These tags help in better organizing the table content and are especially useful for styling and accessibility.

Employee Table

This table lists employee data including their ID, name, and department.

Employee Data
Employee ID Employee Name Department Salary
E001 John Doe Sales $5000
E002 Jane Smith Marketing $6000
E003 Michael Brown IT $7000

Product Table

This table lists product information including the product ID, name, and price.

Product List
Product ID Product Name Price
P001 Laptop $1000
P002 Smartphone $800
P003 Tablet $500

HTML Table Code Example

<table border="1">
<caption>Employee Data</caption>
<thead>
  <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Department</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>1</td>
    <td>John Doe</td>
    <td>Sales</td>
  </tr>
</tbody>
</table>

Post a Comment

0 Comments