Neste exemplo, criamos uma tabela simples com três colunas: Nome, Idade e Cidade.
O elemento <thead> contém o cabeçalho e <tbody> contém os dados. O CSS adiciona bordas, espaçamento e cores alternadas nas linhas.
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tabela HTML</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>Exemplo de Tabela</h2>
<table>
<thead>
<tr>
<th>Nome</th>
<th>Idade</th>
<th>Cidade</th>
</tr>
</thead>
<tbody>
<tr><td>João</td><td>25</td><td>São Paulo</td></tr>
<tr><td>Maria</td><td>30</td><td>Rio de Janeiro</td></tr>
<tr><td>Carlos</td><td>35</td><td>Curitiba</td></tr>
</tbody>
</table>
</body>
</html>