Is table good practice the best way to make headings in a table?

I basically have a data table, and I want to set the interval so that it is not all shy together. However, I want the table header line (first line) to ignore the rules for filling the cell.

Is there a good way to do this? Or do I need to create a separate table or something for the header?

+3
source share
4 answers

Yes, in your CSS:

table thead th { padding: 0; }
table tbody td { padding: 15px; }

given that:

<table>
<thead>
<tr>
  <th colspan="4">Big Heading</th>
</tr>
</thead>
<tbody>
<tr>
  <td>1</td>
  <td>2</td>
  <td>3</td>
  <td>4</td>
</tr>
</tbody>
</table>
+14
source

Use thead and tbody .

Use fill styles only for the body.

+1
source
0

You can use th instead of td for table cells in the table header. Then you can define separate styles for the header and for the cells of the body.

0
source

Source: https://habr.com/ru/post/1717337/


All Articles