把一个& nbsp;在一个空的< td>里面? [英] Is it good to put a &nbsp; inside an empty <td>?
问题描述
如果这是结构:
< table cellspacing =0cellpadding =0>
< tr>
< td>我在这里不需要任何东西,我应该总是把& nbsp;这里< / TD>
< td>项目< / td>
< / tr>
< tr>
< td>模型< / td>
< td> one< / td>
< / tr>
< tr>
< td>模型< / td>
< td> two< / td>
< / tr>
< tr>
< td>模型< / td>
< td>三< / td>
< / tr>
< / table>
屏幕阅读器如何读取空白 td
?它在语义上是正确的吗?
语义上正确的恕我直言将是保持一个空单元真的为空。但是,为了实际的原因,我也使用& nbsp;
s来填充空单元格。
至于屏幕读者,我必须做出一个有根据的猜测:空的节点可能不会被读取,因为HTML主要由空白文本节点组成,读者可以忽略,我假设& nbsp;
折叠到阅读器应用程序中的一个简单空间(因为不间断是可视媒体的属性)。
对于可视化渲染,可以依赖CSS表属性 empty-cells
:
表格{
empty-cells:show;
}
If this is the structure:
<table cellspacing="0" cellpadding="0">
<tr>
<td>I don't need anything here, should I always put a 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?
Semantically correct IMHO would be to keep an empty cell really empty. However, I, too, fill empty cells with
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
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;
}
这篇关于把一个& nbsp;在一个空的< td>里面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!