How to join the cells of a table

Asked

Viewed 327 times

-1

Good night! I’m doing a WHILE of the data coming from the database to a table using css but I couldn’t get the table cells together and with the same border. An example of the table I made:

table{
   width: 100%;
}

table td{
   padding: 10px;
   text-align: center;
   border: 1px solid black;
}
<table>
   <tr>
      <td>
         OK
      </td>
      <td>
         OK
      </td>
      <td>
         OK
      </td>
      <td>
         OK
      </td>
   </tr>
</table>

How to remove these spaces between cells using css only?

1 answer

2


If I understand the problem, in a simple way it is the attributes

border-Spacing: 0;
border-Collapse;

table
{
            width: 100%;
            border-spacing: 0;
            border-collapse: collapse;
}

table td
{
            padding: 10px;
            text-align: center;
            border: 1px solid black;
            
}
<table>
            <tr>
                <td>
                    OK
                </td>
                <td>
                    OK
                </td>
                <td>
                    OK
                </td>
                <td>
                    OK
                </td>
            </tr>
        </table>

More details can be found at https://www.w3schools.com/css/css_table.asp

Similar question: https://stackoverflow.com/questions/339923/set-cellpadding-and-cellspacing-in-css

  • Thank you, that’s what I wanted. so simple and I couldn’t.

Browser other questions tagged

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