views:

500

answers:

5

I have an empty table row just for separation between rows.

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

It's rendered in IE, FF, Opera and Safari. The question is, whether I should put some content inside of it or it is okay to leave it as it is?

Like:

<tr>
  <td colspan="5">&nbsp;</td>
</tr>
+7  A: 

Well you could put an &nbsp; as column content to make sure the rows are displayed. The better way is to use CSS for spacing though.

Lennart
+1 you should really use CSS for this
Gerrie Schenck
CSS will not work. I also wish to fill cells with background color, while having separators stay white. If I were to put padding onto cells, the padded area would also be filled. I don't want that.
User
A: 

You may have already tried this but if your trying to add some space in between rows have you tried adding some padding.

CELLSPACING=Length (spacing between cells)

CELLPADDING=Length (spacing within cells)

Karl

Karl
+1  A: 

if you want to put content inside, i would use a no-breaking-space: &nbsp;, rather than a normal blank

knittl
+3  A: 

Semantically, does the empty row serve a purpose, or is it purely for layout? If the latter, it may be worth considering dropping the empty row, and providing the separation via CSS. E.g.

<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>

With the following in the stylesheet:

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

Alternatively, you can use multiple <tbody> elements to group blocks of rows together (adding rules="groups" to the table element causes <tbody> elements to gain a horizontal border at top and bottom, and <colgroup> element to gain a border to their left and right):

<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>
Jason Musgrove
+1  A: 

As you can see in this example from W3Schools using the &nbsp; is the best way to do what you want.

João Guilherme