HTML-Table-tag
admin
How to Create a Table in HTML #HTML-Table-tag
The HTML <table>
tag is a powerful tool for organizing and displaying data in a structured format. Whether you’re creating a financial report, a pricing comparison, or a calendar, HTML tables allow you to arrange data into rows and columns.
To create a table in HTML, use the following structure:
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
<tr>
tag.<th>
(header) and <td>
(data) tags.
The <table>
tag supports several attributes:
Here’s an example of a basic HTML table:
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Example</title>
</head>
<body>
<table border="1">
<tr>
<th>Language</th>
<th>Rank</th>
</tr>
<tr>
<td>Python</td>
<td>1</td>
</tr>
<tr>
<td>Java</td>
<td>2</td>
</tr>
<tr>
<td>PHP</td>
<td>3</td>
</tr>
</table>
</body>
</html>
<th>
tag.border
.Ready to create your own HTML tables? Start by organizing your data into rows and columns using the examples above!