Tables

Tables

In HTML, tables are used to display data in a structured format, with rows and columns. Here’s an overview of how to create tables in HTML:

<table> tag: This tag defines the start of a table.

<tr> tag: This tag defines a table row.

<th> tag: This tag defines a table header cell, typically used for column headings.

<td> tag: This tag defines a table data cell, used for displaying data within the table.

<caption> tag: This tag defines a caption for the table.

Here’s an example of a basic HTML table:

<table>

  <caption>Monthly Sales Report</caption>

  <tr>

    <th>Month</th>

    <th>Sales</th>

  </tr>

  <tr>

    <td>January</td>

    <td>$10,000</td>

  </tr>

  <tr>

    <td>February</td>

    <td>$15,000</td>

  </tr>

</table>

In the above example, the <table> tag defines the start of the table, while the <caption> tag is used to provide a caption for the table. The <tr> tag defines a table row, while the <th> and <td> tags define table header and data cells, respectively. The table contains two columns, “Month” and “Sales”, and three rows of data. It’s important to note that tables should be used for tabular data only, and not for layout purposes. In modern web development, tables are typically used only for displaying data, while layout is achieved using other techniques such as CSS.

Apply for HTML Certification

https://www.vskills.in/certification/certified-html-designer

Back to Tutorials

Share this post
[social_warfare]
MIME types
Frame Basics

Get industry recognized certification – Contact us

keyboard_arrow_up