In this tutorial, we will look at how to create tables in HTML. Here are a few tags to create a table <tr>
– represents rows, <td>
– used to create data cell <th>
– used to add table headings.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Table Example</title>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>HTML Table Example</h2>
<table>
<tr>
<th>Language</th>
<th>Framework</th>
<th>Database</th>
</tr>
<tr>
<td>Python</td>
<td>Django</td>
<td>Postgres</td>
</tr>
<tr>
<td>Php</td>
<td>Laravel</td>
<td>Mysql</td>
</tr>
<tr>
<td>Java</td>
<td>Spring</td>
<td>Oracle</td>
</tr>
</table>
</body>
</html>
Here is the output.