Why does my "th" tag have space between the columns after I apply background?

Asked

Viewed 29 times

0

Good afternoon! So guys, when I’m applying background on my th the columns are separate, as you can see in the image. Can you help me understand why, thank you!

resultado da tabela

index.html

<!DOCTYPE html>
<html>
    <head>
        <title>Lista de pedidos</title>
        <link rel="stylesheet" href="css/index.css">        
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>-</th>
                    <th>Mercado</th>
                    <th>Pedido</th>
                    <th>Valor</th>
                    <th>Data</th>
                    <th>Situação</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Logo</td>
                    <td>Loja1</td>
                    <td>200201197</td>
                    <td>R$10000</td>
                    <td>21-12-2019</td>
                    <td>Pedido entregue</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

index css.

th {
    background: #C0C0C0;

}


1 answer

1


It is because the <table> by default has the property cellspacing defined in 1. This 1 is the space... set to 0 that will solve.

<table cellspacing="0">
...
</table>
  • It worked out! Thanks Bruno!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.