相关疑难解决方法(0)

表示非数据表格单元格的 HTML 表格

我想知道是否有方法将表格中的某些元素/表格单元格表示为非数据?例如,如果我在每一行的末尾都有一个按钮:

<table>
  <tr>
    <th>header 1</th>
    <th>header 2</th>
  </tr>
  <tr>
    <td>data A1</td>
    <td>data A2</td>
    <button onclick="doSomething()">Do Something</button>
  </tr>
  <tr>
    <td>data B1</td>
    <td>data B2</td>
    <button onclick="doSomething()">Do Something</button>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

将按钮放入 every 的正确方法是什么<tr>?我应该把它放在一个<td>(没有列标题)中吗?使用屏幕阅读器的人会感到困惑吗?就可访问性而言,这里的最佳实践是什么?

html accessibility

3
推荐指数
1
解决办法
490
查看次数

How to hide a text and make it accessible by screen reader?

我有一个简单的文本,它会更新一个动作,我希望屏幕阅读器可以宣布它。但我不希望该文本在网页上可见。我试过display: nonevisibility: hidden,但似乎屏幕阅读器软件无法访问它们。我找到了一种方法来完成这项工作 - 即通过使用负 999999 值一直绝对定位元素,这将使其离开屏幕并从网页中隐藏。我不是这个解决方案的粉丝。有没有更优雅的方法来实现这一目标?

<span class="aria-invisible" aria-live="polite">5 selections have been made.</span>

.aria-invisible {
   display: none; //either of these two attributes
   visibility: hidden;
}
Run Code Online (Sandbox Code Playgroud)

html css accessibility wai-aria

1
推荐指数
2
解决办法
2052
查看次数

标签 统计

accessibility ×2

html ×2

css ×1

wai-aria ×1