Will a table row be displayed if all its cells are empty?

I have an empty table row only for separating between rows.

<tr>
  <td colspan="5"></td>
</tr>

It is displayed in IE, FF, Opera, and Safari. The question is, should I put some content in it or can it leave it as it is?

how

<tr>
  <td colspan="5">&nbsp;</td>
</tr>
+5
source share
9 answers

Well, you can put &nbsp;as the contents of a column to make sure the rows are displayed. It is best to use CSS for spacing.

+11
source

, ? , , CSS. .

<tr class="separate-below">
    <td>Data before separater</td><td>More Data</td>...
</tr>
<tr>
    <td>Data after separater</td><td>More Data</td>...
</tr>

:

TR.separate-below TD,TR.separate-below TH {
    border-bottom: 1em solid white; /* use the background colour of a cell here */
}

<tbody> ( = "" <tbody> , <colgroup> , )

<table rules="groups">
<thead>
    <tr><th>Header</th><th>Header</th>...</tr>
</thead>
<tbody>
    <tr><td>Data</td><td>Data</td>...</tr>
    <tr><td>Data</td><td>Data</td>...</tr>
    ...
</tbody>
<tbody>
    <tr><td>Data</td><td>Data</td>...</tr>
    ...
</tbody>
...
</table>
+6

W3Schools &nbsp; - , .

+3

, : &nbsp;,

+1

, - ( display: table-cell table-row elements)

:

.emptyElement:after{
  content: "\00a0";
}
+1

, @Dariusz Sikorski.

td:empty:after, th:empty:after {
  content: "\00a0";
}
+1

, , , .

CELLSPACING = ( )

CELLPADDING = ( )

0

, CSS:

table { empty-cells:show; }
0
source

You can use multiple tags tbodyto group table rows. It is fully valid and more semantic.

0
source

All Articles