gpt4 book ai didi

javascript - 向下滚动时如何卡住表头及其上方的所有内容?

转载 作者:太空宇宙 更新时间:2023-11-04 04:01:41 24 4
gpt4 key购买 nike

我一直在努力尝试卡住表头和上面的所有内容。我已经发布了一个类似的问题并得到了一个我认为很好但最终没有成功的答案。

不需要跨浏览器支持,只需谷歌浏览器即可。

我试图在向下滚动时卡住这部分 html:

<input>input1</input>
<input>input2</input>
<button>A</button>
<button>B</button>
<button>C</button>
<button>D</button>
<tr><th>header1</th><th>header2</th><th>header3</th><th>header4</th><th>header5</th></tr>

这是 fiddle (请根据答案发布 fiddle ):

jsfiddle

谢谢

最佳答案

复制粘贴:

<div style="position:fixed; height:40px;">
<input>input1</input>
<input>input2</input>
<button>A</button>
<button>B</button>
<button>C</button>
<button>D</button>
<table >
<tr ><th>header1</th><th>header2</th><th>header3</th><th>header4</th><th>header5</th></tr>
</table>
</div>
<p style="height:2000px; padding-top:150px;">hello</p>

关于javascript - 向下滚动时如何卡住表头及其上方的所有内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21981099/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com