【问题标题】:How to lock the first row and column of a table?如何锁定表格的第一行和第一列?
【发布时间】:2022-09-23 14:58:57
【问题描述】:

我目前正在将我的公司文档转移到维基媒体服务器中。我想转移很多非常大且宽泛的 Excel 表。我已经使用这个 div 实现了表格的滚动:

<div style=\"overflow-x: scroll\">

但是我将如何锁定第一行和第一列,这样用户就不必经常检查他们在哪里?

  • table > thead > tr > * 上使用position: sticky; top: 0

标签: mediawiki wiki-markup


【解决方案1】:

使用sticky

<div style="height: 20ex; width: 20em; overflow-x: auto; overflow-y: auto">
{| class="wikitable"
! 
! style="position: sticky; top: 0;" | Col1
! style="position: sticky; top: 0;" | Col2
! style="position: sticky; top: 0;" | Col3
! style="position: sticky; top: 0;" | Col4
! style="position: sticky; top: 0;" | Col5
! style="position: sticky; top: 0;" | Col6
! style="position: sticky; top: 0;" | Col7
! style="position: sticky; top: 0;" | Col8
! style="position: sticky; top: 0;" | Col9
! style="position: sticky; top: 0;" | Col10

|-
! style="position: sticky; left: 0;" | Row 1
| Cell 1,1 || Cell 1,2 || Cell 1,3 || Cell 1,4 || Cell 1,5 || Cell 1,6 || Cell 1,7 || Cell 1,8 || Cell 1,9 || Cell 1,10

(many more rows)

|}
</div>

【讨论】:

    猜你喜欢
    • 2023-03-13
    • 2010-09-22
    • 2017-12-17
    • 2020-07-24
    • 2019-12-17
    • 1970-01-01
    • 1970-01-01
    • 2015-02-06
    • 1970-01-01
    相关资源
    最近更新 更多