gpt4 book ai didi

html - 根据窗口滚动条移动div

转载 作者:行者123 更新时间:2023-11-28 04:43:23 26 4
gpt4 key购买 nike

如果我的窗口向下滚动并在窗口向上滚动时向上移动,我想将我的 div 向下移动吗?如何实现?

最佳答案

<div style="position:fixed;">
<p>Hello World</p>
</div>

position:fixed

Generates an absolutely positioned element, positioned relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties.

Source: http://www.w3schools.com/Css/pr_class_position.asp

关于html - 根据窗口滚动条移动div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1160911/

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