滚动div高度后CSS Sticky标头消失

时间:2018-07-09 12:03:27

标签: css scroll sticky

编辑:该问题已解决。不幸的是,我在此处发布的代码中没有任何内容,因此发布答案不会有多大好处。这是一个框架问题。

正如标题所示,通过在CSS中使用<thead>,我有了一个带有粘性position: sticky;的div(带有一个表)。但是,在滚动div高度后,标题只会随内容向上滚动。

html代码是这样的

<div class="tablewrapper">
    <table>
        <thead>content with tr and th's</thead>
        <tbody>more content with tr and td's</tbody>
    </table>
</div>

我的CSS代码如下:

.tablewrapper {
    overflow: auto;
}

.tablewrapper table {
    /* This is empty */
}

.tablewrapper thead {
    display: block;
    position: sticky;
    overflow: visible
}

.tablewrapper tbody {
    overflow: visible;
    display: block;
}

滚动条来自.tablewrapper

如何使thead保持粘性?

还要澄清一下,该代码比这里的要先进得多,因此很遗憾,我不得不将滚动条放在tablewrapper上。

最好使用纯CSS修复

1 个答案:

答案 0 :(得分:0)

添加import numpy as np from scipy.optimize import fixed_point, root root(lambda x: np.exp(x) - 1, 3) # converges to 0 in 14 steps fixed_point(lambda x: np.exp(x) - 1 + x, 3) # RuntimeError: Failed to converge after 500 iterations, value is 2.9999533400931266 thead标签将在到达顶部时粘住

Top: 0;
相关问题