如何创建< div>当我滚动页面时上下移动? [英] How do I make a <div> move up and down when I'm scrolling the page?

查看:99
本文介绍了如何创建< div>当我滚动页面时上下移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户滚动页面时,如何使div元素在页面上下移动? (其中该元素始终可见)

How can I make a div element move up and down the page when the user is scrolling the page? (where that element is always visible)

推荐答案

您要将固定属性应用于元素的位置样式。 p>

You want to apply the fixed property to the position style of the element.

position: fixed;

您使用哪种浏览器?并非所有浏览器都支持固定属性。阅读更多关于谁支持,谁不支持和一些工作。

What browser are you working with? Not all browsers support the fixed property. Read more about who supports it, who doesn't and some work around here

http://webreflection.blogspot.com/2009/09/css-position-fixed-solution.html

这篇关于如何创建< div>当我滚动页面时上下移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆