css之:scope的使用:
html中 talbe 中的 scope的使用:
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Age</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Alice</th>
<td>25</td>
</tr>
<tr>
<th scope="row">Bob</th>
<td>30</td>
</tr>
</tbody>
</table>
在这个例子中:
"Name" 和 "Age" 是列标题,所以使用 scope="col"
"Alice" 和 "Bob" 是行标题,所以使用 scope="row"
虽然在视觉上可能看不出差别,但这种结构化信息对于使用辅助技术的用户非常重要,能够帮助他们更好地理解表格的组织结构。
<td> 标签代表 "table data"(表格数据),是 HTML 表格中最基本和最常用的元素之一。它用于创建表格中的标准单元格,包含表格的实际数据。
<td> 标签代表 "table data"(表格数据),是 HTML 表格中最基本和最常用的元素之一。它用于创建表格中的标准单元格,包含表格的实际数据。
<tr> 标签代表 "table row"(表格行),用于在 HTML 表格中创建一行。它是构建表格结构的关键元素之一。
table相关文档:
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/table
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/tr
其它关于css的 :scope的使用,下面主要是限定样式生效的范围
https://developer.mozilla.org/zh-CN/docs/Web/CSS/:scope
https://liruifengv.com/posts/css-scope/
和上面的th中的使用是不一样的
