Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it good to put a &nbsp; inside an empty <td>?

If this is the structure:

<table cellspacing="0" cellpadding="0">    <tr>       <td>I don't need anything here, should I always put a &nbsp; here?</td>       <td>item </td>    </tr>    <tr>       <td>model</td>       <td>one</td>    </tr>    <tr>       <td>model</td>       <td>two</td>    </tr>    <tr>       <td>model</td>       <td>three</td>    </tr> </table> 

How will a screen reader read a blank td? Is it semantically correct?

like image 876
Jitendra Vyas Avatar asked Mar 24 '10 08:03

Jitendra Vyas


People also ask

Is put to good use?

: to use (something) in an effective way I'm looking forward to putting my new skills to use. Thanks for the donation.

Can you put in a good word?

Make a supportive remark or favorable recommendation. For example, Please put in a good word for me with the supervisor, or When you see her, put in a good word for the department. The use of good word for a laudatory utterance dates from about 1200.

What does it mean to put a good word?

Definition of put in a good word : to say something good about someone Would you mind putting in a good word for me?


1 Answers

Semantically correct IMHO would be to keep an empty cell really empty. However, I, too, fill empty cells with &nbsp;s for pragmatic reasons.

As for screen readers, I'll have to make an educated guess: Empty nodes will likely not be read, because HTML consists mostly of whitespace text nodes, which readers ignore, and I assume, that &nbsp; is collapsed to a simple space in reader applications (since non-breaking is a property of visual media).

For rendering visually, one could rely on the CSS table property empty-cells:

table {     empty-cells: show; } 
like image 190
Boldewyn Avatar answered Sep 24 '22 17:09

Boldewyn