Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我的窗口向下滚动并在窗口向上滚动时向上移动,我想将我的 div 向下移动?如何实施?
<div style="position:fixed;"> <p>Hello World</p> </div>
位置:固定 生成一个绝对定位的元素,相对于浏览器窗口定位。元素的位置由“left”、“top”、“right”和“bottom”属性指定。 来源:http ://www.w3schools.com/Css/pr_class_position.asp
位置:固定
生成一个绝对定位的元素,相对于浏览器窗口定位。元素的位置由“left”、“top”、“right”和“bottom”属性指定。
来源:http ://www.w3schools.com/Css/pr_class_position.asp
您需要使用 CSS 来执行此操作。
<div style="position:fixed">